DReade83
asked on
PHP mail keeps sending from "nobody@<server_hostname>", resulting emails to fail anti-spam checks
Any idea how I can stop PHP from emailing from "nobody@<server_hostname>" without enabling PHPsuExec?
I've tried the following but to no avail:
<?
ini_set("sendmail_from", "noreply@<domain>");
$strHeaders .= "Return-Path: noreply@<domain>\n\r";
?>
Any help on this topic would be greatly appreciated. Thanks in advance!
I've tried the following but to no avail:
<?
ini_set("sendmail_from", "noreply@<domain>");
$strHeaders .= "Return-Path: noreply@<domain>\n\r";
?>
Any help on this topic would be greatly appreciated. Thanks in advance!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This works for me:
$org_var = "Flight Exams";
$domain_user = "flightexams@flightexams.c om";
$emailfrom = "desouthard@hotmail.com";
$header = "MIME-Version: 1.0\n";
$header .= "Content-type: text/html; charset=iso-8859-1\n";
$header .= "Content-Transfer-encoding : 8bit\n";
$header .= "From: ".$org_var." <".$emailfrom.">\n";
$header .= "Message-ID: <".md5(uniqid(time()))."@f lightexams .com>\n";
$header .= "Return-Path: ".$domain_user."\n";
$header .= "X-Sender: ".$domain_user."\n";
$header .= "X-AntiAbuse: This is a solicited email from - ".$org_var." for an appointment to take an FAA pilot exam.\n";
$header .= "X-AntiAbuse: Servername - FlightExams.com\n";
$header .= "X-AntiAbuse: User - ".$domain_user."\n";
mail("somebody@hotmail.com ", "Subject", $body, $header);
$org_var = "Flight Exams";
$domain_user = "flightexams@flightexams.c
$emailfrom = "desouthard@hotmail.com";
$header = "MIME-Version: 1.0\n";
$header .= "Content-type: text/html; charset=iso-8859-1\n";
$header .= "Content-Transfer-encoding
$header .= "From: ".$org_var." <".$emailfrom.">\n";
$header .= "Message-ID: <".md5(uniqid(time()))."@f
$header .= "Return-Path: ".$domain_user."\n";
$header .= "X-Sender: ".$domain_user."\n";
$header .= "X-AntiAbuse: This is a solicited email from - ".$org_var." for an appointment to take an FAA pilot exam.\n";
$header .= "X-AntiAbuse: Servername - FlightExams.com\n";
$header .= "X-AntiAbuse: User - ".$domain_user."\n";
mail("somebody@hotmail.com
You cannot set Return-Path with the other headers if you are using the PHP mail() command as it uses sendmail. Do it this way:
$to = 'joe@blow.com';
$subject = 'Lower Spam Scores';
$body = 'Blah, blah, blah';
$headers = 'From: webmaster@example.com' . '\r\n' .
'Reply-To: webmaster@example.com' . '\r\n' .
'X-Mailer: PHP/' . phpversion();
$return_path = 'noreply@example.com' ;
mail($to, $subject, $body, $header, '-f $return_path');
Cheers,
RDB
$to = 'joe@blow.com';
$subject = 'Lower Spam Scores';
$body = 'Blah, blah, blah';
$headers = 'From: webmaster@example.com' . '\r\n' .
'Reply-To: webmaster@example.com' . '\r\n' .
'X-Mailer: PHP/' . phpversion();
$return_path = 'noreply@example.com' ;
mail($to, $subject, $body, $header, '-f $return_path');
Cheers,
RDB
Nuts...
Made a mistake in the mail() command in my post above!
Should be HEADERS, not header as in:
mail($to, $subject, $body, $headers, '-f $return_path');
RDB
Made a mistake in the mail() command in my post above!
Should be HEADERS, not header as in:
mail($to, $subject, $body, $headers, '-f $return_path');
RDB
ASKER
It's OK, '-f' sorted it at the time. Thanks anyway.
Sorry,
I saw the question was still open and thought you did not have an answer. You should close the question, you can ask for your points back. It should not be a problem as you found your own solution!
Cheers! Happy New Year!
RDB
I saw the question was still open and thought you did not have an answer. You should close the question, you can ask for your points back. It should not be a problem as you found your own solution!
Cheers! Happy New Year!
RDB
ASKER
No probs, cheers mate. Happy 2008 to you too. :)
Closed, 500 points refunded.
modus_operandi
EE Moderator
modus_operandi
EE Moderator
mail( "to@email", "Subject","body", "From: from@email");
http://php.net/mail