Dear friends, I need a PHP mail sending functon/code that will go to inbox (not in spam or junk box). I want to use it to my site user registration system. Please help me. Thanks
PHP code is not involved here, emails dropping into spam/junk is because of your server configuration. Try using Gmail SMTP, but it limits to 500 mails/day. Or you can try installing postfix and follow some guidelines about hostname and domain configuration. Yet another solution, you can rent 3rd party for sending emails. I'm new to forum so I cannot put the links here, please google!
The control of where any particular email goes is in the email program, you have no control over that. Any user can simply set your address, or a word you use in your emails, to go to his spam folder. How do you prevent this? You don't send spam email. Contrary to what mattgos says, it has nothing to do with the server. I can send anything from any gmail account to my spam folder. I can even have it delete before I see it. (Any emails I get with dollar signs in the subject get deleted. So do about 30 other typical spam formats.) The days of forcing people to read your emails have been over for years now, so change your business model.
It's not actually about your code but the way you sent it, PHP mail is an option where it ends up in SPAM most time, but if you use SMTP with a good provider you will be able to hit the INBOX. I would recommend SendGrid they have advanced system and gives 200 free emails per day.
You should also format the headers for the emails you are sending - If your headers are configured then you shouldn't wind up in the "spam" folder UNLESS a user sets filters, like Rukbat does... For Example.... $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'To: Person <person@people.com>, Another One <metoo@somewhere.com>' . "\r\n"; $headers .= 'From: My Name <myemail@address.com>' . "\r\n"; $headers .= 'Cc: ' . "\r\n"; $headers .= 'Bcc: ' . "\r\n"; Code (markup):
Actually, the programmer can have a degree of control over this. It may be that additional headers are missing. Some servers also require a "replyto: ". Read about additional headers here: http://uk.php.net/manual/en/function.mail.php It may help.