[Unknown]
Global Moderator
YaBB God
    
Posts: 7830


|
 |
Re:Sendmail: Not inseting the "from" in email header
« Reply #4 on: September 06, 2003, 07:16:17 PM » |
|
It seems your server is not properly parsing the From header. I guess it must not realize that it is part of the headers...
Your old function in Subs.php should look like this:
function sendmail($to, $subject, $message, $from = null) { global $mailtype, $webmaster_email, $modSettings;
$chunkSize = 50;
$to_array = (is_array($to) ? $to : array($to));
if ($from == null) $from = $webmaster_email; $subject = stripslashes($subject); $subject = str_replace(array('"', ''', '&', '<', '>'), array('"', '\'', '&', '<', '>'), $subject); $message = stripslashes($message); $headers = "MIME-Version: 1.0\r\n"; $headers .= "From: <$webmaster_email>\r\n"; $headers .= "Return-Path: $webmaster_email";
if ($modSettings['mail_type'] == 'sendmail') foreach ($to_array as $to) $mail_result = mail($to, $subject, $message, $headers); else smtp_mail($to_array, $subject, $message, $headers);
return $mail_result; }
I can't remember properly how I changed it before... but I'll try, and we'll see where we get.
function sendmail($to, $subject, $message, $from = null) { global $mailtype, $webmaster_email, $modSettings, $mbname;
$to_array = is_array($to) ? $to : array($to);
if ($from == null) $from = $webmaster_email; $subject = stripslashes($subject); $subject = str_replace(array('"', ''', '&', '<', '>'), array('"', '\'', '&', '<', '>'), $subject); $message = stripslashes($message);
$headers .= 'From: "' . addcslashes(isset($from) ? $from : $mbname, '<>[]()\'\\"') . '" <' . $webmaster_email . ">\r\n"; $headers .= "Return-Path: $webmaster_email"; $headers = "MIME-Version: 1.0\r\n";
if ($modSettings['mail_type'] == 'sendmail') foreach ($to_array as $to) $mail_result = mail($to, $subject, $message, $headers); else smtp_mail($to_array, $subject, $message, $headers);
return $mail_result; }
Please tell me what this produces. If you use Outlook, please right click on the message and select "Properties..." and then "Details" and finally "Message Source...". This will tell you exactly what was sent.
-[Unknown]
|