Skip to main content

sanitize_address

Format a pair of (name, address) or an email address string.

def sanitize_address(
addr: string | tuple,
encoding: string
) - > string

Format a pair of (name, address) or an email address string.

Parameters

NameTypeDescription
addr`stringtuple`
encodingstringThe character set used to encode non-ASCII characters in the display name or local part of the address.

Returns

TypeDescription
stringA RFC-compliant formatted email address string, with appropriate header encoding and punycode applied to the domain.