PHPMailer Bug: Headers showing in message body
July 1st, 2009
PHPMailer is a handy little class which smoothes out the minefiled that is sending email with PHP. Okay, it’s not exactly difficult, but it’s not always striaghtforward either.
I did come across a niggly little bug in the latest release (2.3 at time of writing) which causes a large number of mail clients to incorrectly parse the generated email headers. The most obvious manifestation of this bug is that the headers are displayed in the body. Which probably isn’t what you want.
Fortunately the ‘fix’ is simple. By default PHPMailer 2.3 defaults to using “\r\n” for linebreaks. This is what confuses a lot of mail clients as they’re expecting a “\n”.
PHPMailer Class, line 259:
change:
var $LE = "\r\n";
to:
var $LE = "\n";
That worked for me, although YMMV.


July 1st, 2009 at 6:36 pm
FIRST!
July 1st, 2009 at 7:34 pm
Dude, I can’t see any difference between the two lines of code?
July 1st, 2009 at 8:29 pm
oops. fixed!
July 2nd, 2009 at 10:27 am
Tits or GTFO!