email.utils.formataddr()

email.utils.formataddr(pair, charset='utf-8')

The inverse of parseaddr(), this takes a 2-tuple of the form (realname, email_address) and returns the string value suitable for a To or Cc header. If the first element of pair is false, then the second element is returned unmodified.

Optional charset is the character set that will be used in the RFC 2047 encoding of the realname if the realname contains non-ASCII characters. Can be an instance of str or a Charset. Defaults to utf-8.

Changed in version 3.3: Added the charset option.

doc_python
2016-10-07 17:32:58
Comments
Leave a Comment

Please login to continue.