# Released subject to the New BSD License
# Please see http://en.wikipedia.org/wiki/BSD_licenses
+from __future__ import unicode_literals
+
from collections import namedtuple
from email.utils import formataddr
import six
+from .util import to_unicode
+
class Envelope(namedtuple("Envelope", "date subject from_ sender reply_to to " +
"cc bcc in_reply_to message_id")):
"""
def __str__(self):
- return formataddr((self.name, self.mailbox + '@' + self.host))
+ return formataddr((
+ to_unicode(self.name),
+ to_unicode(self.mailbox) + '@' + to_unicode(self.host)))
class SearchIds(list):
}
})
+ def test_Address_str(self):
+ self.assertEqual(str(Address(b"Mary Jane", None, b"mary", b"jane.org")),
+ "Mary Jane <mary@jane.org>")
+
+ self.assertEqual(str(Address("Mary Jane", None, "mary", "jane.org")),
+ "Mary Jane <mary@jane.org>")
+
+
def add_crlf(text):
return CRLF.join(text.splitlines()) + CRLF