You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 28, 2024. It is now read-only.
Short summary: Non-ASCII filenames should be encoded following RFC 2047 in the name parameter of the Content-Type and RFC 2231 in the filename parameter of the Content-Disposition. For example, an attachment named 今日は世.txt might include the following headers:
Any proposed fix should first be tested against a few major email clients.
Originally reported in go-gomail#66, non-ASCII filenames are garbled when attaching files to messages. In looking at some of the proposed solutions (go-gomail#83), some people have solved this by adding charset=UTF-8 to the Content-Type header. This may work for some but that is almost certainly a coincidence which I expect causes more issues later for certain clients and attachments.
Digging into various IETF standards, none of the RFCs seem to specify filename encoding for non-ASCII characters. Take RFC 2183, section 2.3 for example:
Current [RFC 2045] grammar restricts parameter values (and hence
Content-Disposition filenames) to US-ASCII. We recognize the great
desirability of allowing arbitrary character sets in filenames, but
it is beyond the scope of this document to define the necessary
mechanisms.
This thread on the ietf-smtp mailing list seems to have the answer:
Finally, if you have to include filename information, either put it in a
filename= parameter or both a filename= and name= parameter. Never ever use
just a name= parameter because that opens you up to gratuitous interpretation
of the part using some disposition value you didn't intend. (I note in passing
that this is what Thunderbird now dows, with the added nuance of using
nonstandard RFC 2047 encoding for the name= paramter and standard RFC 2231
encoding for the filename= parameter.)
The text was updated successfully, but these errors were encountered:
Short summary: Non-ASCII filenames should be encoded following RFC 2047 in the
name
parameter of theContent-Type
and RFC 2231 in thefilename
parameter of theContent-Disposition
. For example, an attachment named今日は世.txt
might include the following headers:Any proposed fix should first be tested against a few major email clients.
Originally reported in go-gomail#66, non-ASCII filenames are garbled when attaching files to messages. In looking at some of the proposed solutions (go-gomail#83), some people have solved this by adding
charset=UTF-8
to theContent-Type
header. This may work for some but that is almost certainly a coincidence which I expect causes more issues later for certain clients and attachments.Digging into various IETF standards, none of the RFCs seem to specify filename encoding for non-ASCII characters. Take RFC 2183, section 2.3 for example:
This thread on the ietf-smtp mailing list seems to have the answer:
The text was updated successfully, but these errors were encountered: