Wednesday, June 1, 2011

Issue: Mail is not going in Correct Format when you use different OS.

Problem: Mail is not going in Correct Format when you use different OS.
Solution:


if (strtoupper(substr(PHP_OS,0,3)=='WIN')) {
$eol="\r\n";
} elseif (strtoupper(substr(PHP_OS,0,3)=='MAC')) {
$eol="\r";
} else {
$eol="\n";
}
# Common Headers
$headers .= 'From: Jonny '.$eol;
$headers .= 'Reply-To: Jonny '.$eol;
$headers .= 'Return-Path: Jonny '.$eol; // these two to set reply address
$headers .= "Message-ID:<".$now." TheSystem@".$_SERVER['SERVER_NAME'].">".$eol;
$headers .= "X-Mailer: PHP v".phpversion().$eol;


OR
Please refer this url:
http://php.net/manual/en/ref.mail.php


$headers = "From: {$email}";

No comments:

Post a Comment