The best way around this problem would be to use the smtp feature. Unfortunately, using the PHP method will almost always mark them as spam (due to how phpmail and sendmail works). Unless, of course, it comes from a trusted domain.
Hello,
Yes, it's not about the script. It's more an IP issue. Php mail() is using your server's ip to send the email. If that ip is from an ambiguous ip class any email will go to your spam.
i use the SMTP feature with transactional email service from sendgrid or mandrill (they rock)