Was using Free PHP Formmail Generator : http://phpfmg.sourceforge.net to send the contents of a form and when sending to most mail servers/mail clients it would work great. When sending to a Microsoft Exchange server the HTML contents of the email was displayed as text (not marked up).
Tried this with PHP4 and PHP5 and had the same problem.
The mail server on the webserver was qmail. Testing the site on another PHP5 server with postfix the forms worked fine.
It turns out that qmail wasn’t liking the \r\n… it worked fine when changing to \n.
Updated the form.lib.php to look like:
#define( ‘PHPFMG_LNCR’, “\x0d\x0a” );
define( ‘PHPFMG_LNCR’, “\n” );
The test html email worked fine when received on exchange and viewed via Outlook.
http://php.net/manual/en/function.mail.php Anonymous (17-Aug-2009 06:29) said :
QMail seems to have problems with the “\r\n” in the header section. I found it helpful to replace them with “\n”….
$header = 'MIME-Version: 1.0' . "\n" .
'Content-type: text/plain; charset=UTF-8'. "\n" .
'From: Yourname <' . $from . ">\n";
1 response so far ↓
1 Nino // Jun 27, 2010 at 10:22 pm
You were right on! Wish I knew this before I racked my brain going through the code for hours. Thanks.
Leave a Comment