ZF-10383: Filename for attachments in mails

Description

For compatibility reasons with mail clients the headers of a mime part should be

Content-Type: application/pdf; name="file.pdf" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="file.pdf"

instead of

Content-Type: application/pdf; Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="file.pdf"

Otherwise some mail clients wouldn't recognize the filename correctly. Should be fixed in Zend_Mime_Part getHeadersArray

Comments

What are some examples of mail clients that do not recognize the filename correctly?

According to http://tools.ietf.org/html/rfc2045#section-5 the only mentioned comment for the Content-Type header is a charset.

Content-type: text/plain; charset="us-ascii"

Could adding the name comment to the Content-Type cause any BC problems with other mail clients?

I didn't find any problems with the common mail clients like thunderbird, apple mail etc. with the existing header without the name comment.

But the mail client used in 37signals' highrise (http://highrisehq.com/) doesn't parse the filename correctly.

And mails with attachments send with thunderbird are using this name comment for attachments, too. Even though this is not mentioned in the RFC.

Confirmed that Gmail also adds the file name comment to the content-type:

Content-Type: image/jpeg; name="Screenshot.jpg" Content-Disposition: attachment; filename="Screenshot.jpg" Content-Transfer-Encoding: base64

I can work on a patch this weekend.

Patch with tests attached.

I also confirmed that in Gmail, if an attachment has both a charset and a filename that the charset comes before the name comments, like this:

Content-Type: text/plain; charset=US-ASCII; name="test.txt" Content-Disposition: attachment; filename="test.txt" Content-Transfer-Encoding: base64

Simon, can you please apply this patch and see if it works well for you?

Thanks for this patch! Works perfectly.

Would be gald to see the patch applied in the next release of ZF!

Any updates on this issue?

I would really like to see this patch being applied in one of the next releases. Please give us an update!