the default From header encoding is dumb: it encodes the *whole*
string, including the address itself, which breaks a bunch of email
clients, including gmail, notmuch and mutt.
instead, we encode the address and name separately so that the address
doesn't get encoded so clients can parse it properly.
also, this should encode the name only if necessary.
taken from http://mg.pov.lt/blog/unicode-emails-in-python.html
↧