elmas156 Posted December 14, 2010 Share Posted December 14, 2010 Hello everyone, I have website that uses the php(mail) function to notify users when something happens on their account. The site was created for a school district so all the users are district employees where their incoming email is subject to pretty strict spam filtering. I am using headers to indicate to the recipient that the email is coming from [email protected], but I guess the mail servers see past this and recognize that it's coming from a php(mail) function. Because of this, all of the emails being sent are being blocked by the filter. I've tried adding all emails coming from an address that ends with "@mysite.com" but this doesn't work. This is what the addresses look like that the spam filter is actually seeing: [email protected] And I can't just add a single address to the white list because each time an email is sent, the letters and numbers after "@" and before "secureserver.net" are different. Here's another address that shows up: [email protected] here is the code that I'm using to send the emails: <?php $sendto = "$email"; $emailsubject = "Testing Message Report For $cdate."; $emailmessage = "This is a test email."; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'From: MySite.com Report <[email protected]>' . "\r\n"; // Mail it mail($sendto, $emailsubject, $emailmessage, $headers); ?> Does anyone have any suggestions on what to do to make every email sent to be recognized by the spam filter as coming from the same email instead of a bunch of random ones? I hope this is making sense to someone because it was very difficult for me to explain in writing. Thanks in advance for any help or suggestions. Link to comment https://forums.phpfreaks.com/topic/221642-phpmail-function-and-spam-filters/ Share on other sites More sharing options...
kenrbnsn Posted December 14, 2010 Share Posted December 14, 2010 You can try using the optional fifth parameter to pass a flag to the email program on your host (usually sendmail or exim) to set the message envelope address: <?php $fifthp = '-f [email protected]'; mail($sendto, $emailsubject, $emailmessage, $headers, $fifthp); ?> This may not work on all hosts. Ken Link to comment https://forums.phpfreaks.com/topic/221642-phpmail-function-and-spam-filters/#findComment-1147231 Share on other sites More sharing options...
elmas156 Posted December 14, 2010 Author Share Posted December 14, 2010 I'm getting this error now: Parse error: syntax error, unexpected T_STRING in /home/content/29/6879529/html/mysite/newmsg.php on line 85 this is line 85: mail($sendto, $emailsubject, $emailmessage, $headers, $fromaddress); any ideas? Link to comment https://forums.phpfreaks.com/topic/221642-phpmail-function-and-spam-filters/#findComment-1147264 Share on other sites More sharing options...
elmas156 Posted December 14, 2010 Author Share Posted December 14, 2010 Never mind... I figured out that I left out a semi-colon on line 84 ;-) I think this did the trick. Thanks very much for your help. Link to comment https://forums.phpfreaks.com/topic/221642-phpmail-function-and-spam-filters/#findComment-1147288 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.