I encountered a problem with the attachment sent by mimemails. I used directly the mimemail interface and i attached PDF documents to the mail. Everything seems fine, but in several cases i get an PDF attachment only filled with "NULL". After a longer investigation I detected, that the problem only occurs in my MS Outlook eMail cient. In the case of using my webclient, everything worked fine.
The problem is MS Outlook and the CRLF. In the mimemail.inc file, I found the usage of chunk_split (line 312). It is used in the following way: chunk_split(base64_encode($file)).
The PHP documentation describes the following:
string chunk_split ( string $body [, int $chunklen = 76 [, string $end = "\r\n" ]] )
This means in the above described case, the
crlf = "\r\n" will be used. And this is a problem for MS Outlook. MS Outlook expects only a
crlf = "\n".
So please replace the line 312 in the mimemail.inc with:
chunk_split(base64_encode($file), 76, variable_get('mimemail_crlf', "\n"))
and the problem won't occur anymore.