muratgozel / MIMEText

RFC-2822, RFC-2045 and RFC-2049 compliant raw email message generator.
https://muratgozel.github.io/MIMEText/
MIT License
80 stars 35 forks source link

MIME encode sender name #27

Closed askkaz closed 1 year ago

askkaz commented 1 year ago

We have noticed some issues with sending emails with emojis in the from name. With some trial and error, we were able to send emails successfully by manually encoding this string before using setSender. I think the raw representation of the message should be updated in this package to automatically encode the From field similar to how the Subject field already does.

muratgozel commented 1 year ago

Hi @askkaz that must be right i never tried to use emojis in from names. could you share the encoding you used? its okay if not possible, i will try something similar done for Subject. thanks for bringing this.

askkaz commented 1 year ago

Here is what did not work: from: "✨ Hello There" <myname@example.com>

And here is what did work: from: "=?utf-8?B?4pyo?= Hello There" <myname@example.com>

I believe this is the same approach that the Subject takes.

Thanks so much for looking at this!!

muratgozel commented 1 year ago

hey @askkaz closing this issue as its been resolved in v2.1 😌 hope it works as intended for you.

if curious, for more info about these weird encoding syntax, you can refer here: https://dmorgan.info/posts/encoded-word-syntax/