mattupstate/flask-mail — pull request #35 by wojcikstefan (2013-03-28 07:30:48+00:00)
Title: Fix header encoding

There's an issue with stdlib's email module - it encodes the whole header, whereas only the name of a sender/recipient should be encoded (see paragraph *8. Examples* in http://tools.ietf.org/html/rfc2047). That resulted in wrong behavior on gmail and yahoo (haven't tested others).

This PR fixes it by encoding the email identities before they go through `email.message.Message.as_string`. It also uses `rfc822.AddressList` parser to handle identities and fix some corrupted data (instead of raising `BadHeaderError`)