Blank MIME emails

If you are having problems when generated MIME emails, specifically that the body of the email appears empty even though the required content is patently there, check the line feeds.

Apple Mail allows you to view the source with the control characters displayed which is very useful. I noticed that my blank emails were using \n where lines had been output by qmail and by my own code but \r\n for headers generated by PEAR’s Mail_mime class. The first time \r\n was used was in the content type header, specifying the boundary. The boundary wasn’t being found and the email was blank.

define("MAIL_MIME_CRLF", "\n"); was the quick fix. The results work fine in Apple Mail, Eudora, Outlook 2000 and XP, Outlook Express 5 and 6, Hotmail and SquirrelMail.