0

I'm sending a PDF and a short text message with Mail_mime 1.8.8 (+ Mail 1.2.0). Almost every test is without a problem. Including GMail and Apple iCloud.

But it seems some recipients have trouble reading the attachment. Users of United Internet (1&1 and GMX) get empty lines between all the lines in the body.

As it's a multipart/mixed e-mail with headers in the body, the attachment is broken.

Is there a known problem with the e-mails generated with Mail_mime that could cause that? Regardless if the e-mail provider is using software that ignores the principles of Jon Postel to be tolerant with the data it receives?

stesch
  • 7,202
  • 6
  • 47
  • 62
  • could probably a mix of `crlf` and/or `cr` or just the wrong line terminator cause the problem? Probably you need to set it explicitly? – Axel Amthor Mar 18 '14 at 15:24
  • @AxelAmthor I checked the source of Mail_mime and it uses a CRLF for end of line. It could be that at some point it doesn't use CRLF and every parser can cope with it but the one from United Internet. But I have no idea how to check this. I read a test e-mail with mutt and piped it in xxd: all line endings are LF. I guess converted to native EOL of the receiving host. – stesch Mar 18 '14 at 20:06
  • There's a PHP constant CRLF which is populated depending on the current OS, PHP is running on. It can of course be set explicitly, so you need to check that. Your self-answer below points into the same direction. – Axel Amthor Mar 19 '14 at 09:14

2 Answers2

0

PEAR packages Mail and Mail_mime don't work together without tweaking the parameters to Mail_mime: http://pear.php.net/manual/en/package.mail.mail-mime.mail-mime.php

You need to set EOL to a single linefeed.

stesch
  • 7,202
  • 6
  • 47
  • 62
  • For this project I used version 1.5.3 of Mail_mime, package from Ubuntu 10.04 LTS. Installing the newest package by hand was the last resort. Funny fact: The example script in the tar archive to Mail_mime has the same bug. Almost all e-mail providers use software that is tolerant regarding the EOL. Only United Internet (1&1, GMX, etc.) has problems with it. The code for Mime_mail was used this way for over 10 years and nobody reported any problems. – stesch Mar 19 '14 at 07:30
0

check your syntax (Multipart Content-Type, MIME) & structures of header and body:

as described in RFC822 RFC2045 RFC2046

Community
  • 1
  • 1