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
Posted by Konr Ness (konrness) on 2010-09-02T21:59:08.000+0000
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?
Posted by Simon Stücher (billomat) on 2010-09-03T02:41:51.000+0000
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.
Posted by Konr Ness (konrness) on 2010-09-03T05:48:25.000+0000
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.
Posted by Konr Ness (konrness) on 2010-09-03T22:44:55.000+0000
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?
Posted by Simon Stücher (billomat) on 2010-09-06T03:37:10.000+0000
Thanks for this patch! Works perfectly.
Would be gald to see the patch applied in the next release of ZF!
Posted by Simon Stücher (billomat) on 2010-11-30T08:17:54.000+0000
Any updates on this issue?
Posted by Simon Stücher (billomat) on 2011-05-10T08:35:51.000+0000
I would really like to see this patch being applied in one of the next releases. Please give us an update!