note 45413 added to ref.mail

From: Date: Mon, 06 Sep 2004 08:03:43 +0000
Subject: note 45413 added to ref.mail
Groups: php.notes 
Request: Send a blank email to php-notes+get-76090@lists.php.net to get a copy of this message
We have a open source project that needed to be able to function on as many platforms and configurations as possible. Using '\n' as end-of-line for emailheaders would probably 'break' the email functionality on Windows and Mac platforms. I have fixed this using the code below. Please note that since I don't have any access to a Mac server, this setup is not tested on a Mac, but should work. if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) { $s_eol = "\r\n"; } elseif (strtoupper(substr(PHP_OS, 0, 3) == 'MAC')) { $s_eol = "\r"; } else { $s_eol = "\n"; } (Thanx to Eric Gach on http://www.phpbuilder.com/lists/php-windows/2003032/0057.php for the inspiration!) Then construct your headers using $s_headers = 'From: registrationform@example.org' . $s_eol; Hope this helps anyone!!! Ivo ---- Manual Page -- http://www.php.net/manual/en/ref.mail.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+45413 Delete -- http://master.php.net/manage/user-notes.php?action=delete+45413&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+45413&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#76090) next »