ID: 41732 Comment by: bas at tobin dot nl Reported By: as at as dot hu Status: Open Bug Type: Mail related Operating System: Windows 2003 PHP Version: 4.4.7 New Comment:
Hi, This is not a bug of PHP. E-Mail being transferred between mail servers needs CrLf (\r\n) as EOL separator. The catch however is how PHP sends the mail to your outbound mail server. On windows you always need to separate mail headers and end of lines with CrLf as this is the standard windows EOL separator. On Linux this depends on the mail injector of your Mail Server. For instance qmail expects the EOL separator to be the same as the standard linux separator Lf(\n) and when sending the message outbound converts all these Lf's to CrLf. If you feed this script with CrLf you will send E-Mail messages having extra white lines. If your PHP script does not send the message to a typical local mail injector but to a normal inbound mail port it will have to follow RFC's and CrLf will be needed again. So depending on your setup you either need to send CrLf or Lf between lines. Previous Comments: ------------------------------------------------------------------------ [2007-06-18 20:32:03] as at as dot hu Description: ------------ On Windows 2003, default smtp server. When I use the mail function, some target e-mail system say: 195.56.151.XX, OutboundConnectionResponse, 2007. 06. 18., 22:06:43, SMTPSVC1, AS, -, 312, 0, 47, 0, 0, -, -, 451 See http://pobox.com/~djb/docs/smtplf.html., Reproduce code: --------------- $subject = "Elveszett jelszó"; $headers = "From: ".$mail_pswd_from."\nX-FW-MailID:s6s06s9s80"; $row=mysql_fetch_array($result); $to = $row['usr_email']; $body = "Tisztelt ".$row[usr_lastname]." ".$row[usr_firstname]."!\nAz Ön jelszava: ".$row[usr_pswd]."\n\nÜdvözlettel,\nA S"; mail($to,$subject,$body,$headers); Expected result: ---------------- The email bounce to the sender from some hosts. (like citromail.hu, vipmail.hu) with this error message: http://pobox.com/~djb/docs/smtplf.html Actual result: -------------- When I replace all newline to CRLF, the mail went away without problem: $subject = "Elveszett jelszó"; $headers = "From: ".$mail_pswd_from."\nX-FW-MailID:s6s06s9s80"; $row=mysql_fetch_array($result); $to = $row['usr_email']; $body = "Tisztelt ".$row[usr_lastname]." ".$row[usr_firstname]."!\nAz Ön jelszava: ".$row[usr_pswd]."\n\nÜdvözlettel,\nA S"; $body = str_replace("\r\n","\n",$body); $body = str_replace("\r","\n",$body); $body = str_replace("\n","\r\n",$body); mail($to,$subject,$body,$headers); ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41732&edit=1