Address

An Address is a str that holds one address in its display-name form.

Usage

Source

Address()

email.utils.formataddr writes the value, so a hand-written string with the same text is indistinguishable from it. See ADR-0014.

Parameters

name

The display name, quoted or RFC 2047-encoded as needed. An empty name leaves the address bare.

email
The address, in ASCII. Pass a non-ASCII address as a plain string instead.

Raises

TypeError

When name or email is not a str.

ValueError
When name or email holds a surrogate. When email is not ASCII, with the UnicodeEncodeError as __cause__.

Examples

from epistole import Address

Address("Ada Lovelace", "ada@example.com")  # "Ada Lovelace <ada@example.com>"
Address("Lovelace, Ada", "ada@example.com")  # '"Lovelace, Ada" <ada@example.com>'

Methods

Name Description
__new__() Return the formatted address.

__new__()

Return the formatted address.

Usage

Source

__new__(name, email)