note 13004 deleted from function.mail by jimw

From: Date: Wed, 31 Oct 2001 23:23:58 +0000
Subject: note 13004 deleted from function.mail by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-19913@lists.php.net to get a copy of this message
I've had problems with the mail function on Win32. After a bit of fiddeling I found out that on Win32 the line separator has to be \r\n and not \n as it is on Unix. This is both in the message body and in the additional parameters. To get phorum up and working, I made my own function like this: function MyMail($to,$subject,$message,$additional_headers="",$additional_parameters="") { $message = str_replace("\n","\r\n",$message); $additional_headers = str_replace("\n","\r\n",$additional_headers); $additional_parameters = str_replace("\n","\r\n",$additional_parameters); if (strlen($additional_parameters))<br>return mail($to,$subject,$message,$additional_headers,$additional_parameters); if (strlen($additional_headers)) return mail($to,$subject,$message,$additional_headers); return mail($to,$subject,$message); } (I know this function looks wierd, tricky to format without HTML) And then I could change all calls to mail() into MyMail() and phorum works fine. (Easier than changing all the \n into \r\n throughout the code)

« previous php.notes (#19913) next »