Index: trunk/kernel/include/emailmessage.php =================================================================== diff -u -r999 -r1128 --- trunk/kernel/include/emailmessage.php (.../emailmessage.php) (revision 999) +++ trunk/kernel/include/emailmessage.php (.../emailmessage.php) (revision 1128) @@ -724,16 +724,19 @@ /* $sql = "INSERT INTO ".GetTablePrefix()."EmailLog VALUES ('', '".htmlspecialchars($From)."', '".htmlspecialchars($To)."', '$Subject', $time, '')"; $conn->Execute($sql);*/ /* ensure headers are using \r\n instead of \n */ - //$headers = str_replace("\r\n","\n",$headers); - //$headers = str_replace("\n","\r\n",$headers); $headers = "Date: ".date("r")."\n".$headers; $headers = "Return-Path: ".$objConfig->Get("Smtp_AdminMailFrom")."\n".$headers; + + $headers = str_replace("\n\n","\r\n\r\n",$headers); + $headers = str_replace("\r\n","\n",$headers); + $headers = str_replace("\n","\r\n",$headers); - if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) { + // if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) { + $Msg = str_replace("\n\n","\r\n\r\n",$Msg); $Msg = str_replace("\r\n","\n",$Msg); $Msg = str_replace("\n","\r\n",$Msg); - } + // } //echo "
"; print_r(htmlentities($headers)); echo ""; //echo "
"; print_r(htmlentities($Msg)); echo ""; @@ -748,7 +751,7 @@ $headers = "Subject: ".trim($Subject)."\r\n".$headers; $send_params['recipients'] = array($To); // The recipients (can be multiple) - $send_params['from'] = $From; // This is used as in the MAIL FROM: cmd + $send_params['from'] = $From; // This is used as in the MAIL FROM: cmd $send_params['headers'] = explode("\r\n",$headers); // It should end up as the Return-Path: header $send_params['body'] = $Msg; // The body of the email @@ -776,7 +779,9 @@ } } else - $SmtpServer->debug = 1; + { + //$SmtpServer->debug = 1; + } $connected = $SmtpServer->connect(); if($connected) @@ -788,6 +793,7 @@ $res = $SmtpServer->send($send_params); } $SmtpServer->disconnect(); + if($this->LogLevel>1) { foreach($SmtpServer->buffer as $l) @@ -869,8 +875,8 @@ $OB="----=_OuterBoundary_000"; $boundary = "-----=".md5( uniqid (rand())); $f = "\"$FromName\" <".$From.">"; - $headers = "From: $f\n"; - $headers .= "MIME-Version: 1.0\n"; + $headers = "From: $f\r\n"; + $headers .= "MIME-Version: 1.0\r\n"; $conn = &GetADODBConnection(); $time = time(); @@ -890,27 +896,33 @@ if($HasFile) { //Messages start with text/html alternatives in OB - $headers.="Content-Type: multipart/mixed;\n\tboundary=\"".$OB."\"\n\n"; + $headers.="Content-Type: multipart/mixed;\r\n\tboundary=\"".$OB."\"\r\n\r\n"; $msg.="--".$OB."\n"; - $msg.="Content-Type: multipart/alternative; boundary=\"$boundary\"\n\n"; + $msg.="Content-Type: multipart/alternative; boundary=\"$boundary\"\r\n\r\n"; } else $headers .= "Content-Type: multipart/alternative; boundary=\"$boundary\""; if(is_array($extra_headers)) { for($i=0;$i