Camel.InternetAddress

g Camel.Address Camel.Address Camel.InternetAddress Camel.InternetAddress Camel.Address->Camel.InternetAddress GObject.Object GObject.Object GObject.Object->Camel.Address

Subclasses:

None

Methods

Inherited:

Camel.Address (10), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

encode_address (len, name, addr)

class

format_address (name, addr)

class

new ()

add (name, address)

ensure_ascii_domains ()

find_address (address)

find_name (name)

get (index)

sanitize_ascii_domain ()

Virtual Methods

Inherited:

Camel.Address (7), GObject.Object (7)

Properties

None

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

Camel.Address

r

Class Details

class Camel.InternetAddress(**kwargs)
Bases:

Camel.Address

Abstract:

No

Structure:

Camel.InternetAddressClass

classmethod encode_address(len, name, addr)
Parameters:
  • len (int or None) – the length of the line the address is being appended to

  • name (str) – the unencoded real name associated with the address

  • addr (str) – the routing address

Returns:

the encoded address

Return type:

str

Encode a single address ready for internet usage. Header folding as per rfc822 is also performed, based on the length len. If len is None, then no folding will occur.

Note: The value at in will be updated based on any linewrapping done

classmethod format_address(name, addr)
Parameters:
  • name (str) – a name, quotes may be stripped from it

  • addr (str) – an rfc822 routing address

Returns:

a nicely formatted string containing the rfc822 address

Return type:

str

Function to format a single address, suitable for display.

classmethod new()
Returns:

a new Camel.InternetAddress object

Return type:

Camel.InternetAddress

Create a new Camel.InternetAddress object.

add(name, address)
Parameters:
  • name (str) – name associated with the new address

  • address (str) – routing address associated with the new address

Returns:

the index of added entry

Return type:

int

Add a new internet address to self.

ensure_ascii_domains()

Ensures that all email address’ domains will be ASCII encoded, which means that any non-ASCII letters will be properly encoded. This includes IDN (Internationalized Domain Names).

New in version 3.16.

find_address(address)
Parameters:

address (str) – address to lookup

Returns:

the index of the address, or -1 if not found

namep:

holder for the matching name, or None, if not required.

Return type:

(int, namep: str or None)

Find an address by address.

find_name(name)
Parameters:

name (str) – name to lookup

Returns:

the index of the address matching the name, or -1 if no match was found

addressp:

holder for address Camel.part, or None, if not required.

Return type:

(int, addressp: str or None)

Find address by real name.

get(index)
Parameters:

index (int) – address’s array index

Returns:

True if such an address exists, or False otherwise

namep:

holder for the returned name, or None, if not required.

addressp:

holder for the returned address, or None, if not required.

Return type:

(bool, namep: str or None, addressp: str or None)

Get the address at index.

sanitize_ascii_domain()
Returns:

True, when converted at least one address

Return type:

bool

Checks the addresses in self for any suspicious characters in the domain name and coverts those domains into their representation. In contrast to Camel.InternetAddress.ensure_ascii_domains(), this converts the domains into ASCII only when needed, as returned by Camel.hostname_utils_requires_ascii().

New in version 3.44.