ZF-10383: Filename for attachments in mails

Issue Type: Patch Created: 2010-08-26T05:17:05.000+0000 Last Updated: 2011-05-17T08:13:56.000+0000 Status: In Progress Fix version(s): Reporter: Simon Stücher (billomat) Assignee: Benjamin Eberlei (beberlei) Tags: - Zend_Mime

  • Attachment
  • Mail

Related issues: Attachments: - ZF-10383.diff


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


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 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 ( 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!

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.