jstedfast / MimeKit

A .NET MIME creation and parser library with support for S/MIME, PGP, DKIM, TNEF and Unix mbox spools.
http://www.mimekit.net
MIT License
1.84k stars 372 forks source link

Attachments with unicode file names appear as “untitled attachment” in Outlook #186

Closed athandor closed 9 years ago

athandor commented 9 years ago

We are using MailKit/MimeKit in our application to send e-mails to users. These e-mails often have attachments with Unicode or long file names. Some e-mail clients, such as Outlook (when using POP or IMAP) or Outlook Express, cannot handle RFC 2231, and the result is that the attachments have names 'Untitled Attachment'.

Is there a way to send mails supporting RFC 2047 (encoded-words) for attachments file names? A possible solution would be to keep RFC 2231 in filename in content-disposition, but use as a fall-back an encoded-word encoded name parameter in content-type. Is something like this supported?

Thanks in advance!

jstedfast commented 9 years ago

There is no way to do this. I would recommend putting pressure on Microsoft to support internet standards that have been around for nearly 20 years (first standardized in 1997).

MimeKit follows the widely accepted internet rules of "be strict in what you send, but liberal in what you accept".

athandor commented 9 years ago

You are right there! Thank you

jstedfast commented 8 years ago

For what it's worth, I added support to encode using rfc2047 a while back:

There are now 2 ways of controlling the encoding method used for parameter values.

The first way is to set the encoding method on each individual Parameter:

param.EncodingMethod = ParameterEncodingMethod.Rfc2047;

The second way is to set the default parameter encoding method on the FormatOptions used for writing out the message and/or MIME part(s):

var options = FormatOptions.Default.Clone ();
options.ParameterEncodingMethod = ParameterEncodingMethod.Rfc2047;

message.WriteTo (options, stream);