Jump to content

php(mail) function and SPAM filters


elmas156

Recommended Posts

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

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

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.