GMime.ParserOptions

Fields

None

Methods

class

get_default ()

class

new ()

clone ()

free ()

get_address_compliance_mode ()

get_allow_addresses_without_domain ()

get_fallback_charsets ()

get_parameter_compliance_mode ()

get_rfc2047_compliance_mode ()

set_address_compliance_mode (mode)

set_allow_addresses_without_domain (allow)

set_fallback_charsets (charsets)

set_parameter_compliance_mode (mode)

set_rfc2047_compliance_mode (mode)

Details

class GMime.ParserOptions

A set of parser options used by GMime.Parser and various other parsing functions.

classmethod get_default()
Returns:

the default parser options.

Return type:

GMime.ParserOptions

Gets the default parser options.

classmethod new()
Returns:

a newly allocated set of GMime.ParserOptions with the default values.

Return type:

GMime.ParserOptions

Creates a new set of GMime.ParserOptions.

clone()
Returns:

a newly allocated GMime.ParserOptions.

Return type:

GMime.ParserOptions

Clones a GMime.ParserOptions.

free()

Frees a set of GMime.ParserOptions.

get_address_compliance_mode()
Returns:

the compliance mode that is currently set.

Return type:

GMime.RfcComplianceMode

Gets the compliance mode that should be used when parsing rfc822 addresses.

Note: Even in GMime.RfcComplianceMode.STRICT mode, the address parser is fairly liberal in what it accepts. Setting it to GMime.RfcComplianceMode.LOOSE just makes it try harder to deal with garbage input.

get_allow_addresses_without_domain()
Returns:

True if the address parser should allow addresses without a domain.

Return type:

bool

Gets whether or not the rfc822 address parser should allow addresses without a domain.

In general, you’ll probably want this value to be False (the default) as it allows maximum interoperability with existing (broken) mail clients and other mail software such as sloppily written perl scripts (aka spambots) that do not properly quote the name when it contains a comma.

This option exists in order to allow parsing of mailbox addresses that do not have a domain component. These types of addresses are rare and were typically only used when sending mail to other users on the same UNIX system.

get_fallback_charsets()
Returns:

a None-terminated list of charsets to try when decoding 8-bit headers.

Return type:

[str]

Gets the fallback charsets to try when decoding 8-bit headers.

get_parameter_compliance_mode()
Returns:

the compliance mode that is currently set.

Return type:

GMime.RfcComplianceMode

Gets the compliance mode that should be used when parsing Content-Type and Content-Disposition parameters.

Note: Even in GMime.RfcComplianceMode.STRICT mode, the parameter parser is fairly liberal in what it accepts. Setting it to GMime.RfcComplianceMode.LOOSE just makes it try harder to deal with garbage input.

get_rfc2047_compliance_mode()
Returns:

the compliance mode that is currently set.

Return type:

GMime.RfcComplianceMode

Gets the compliance mode that should be used when parsing rfc2047 encoded words.

Note: Even in GMime.RfcComplianceMode.STRICT mode, the rfc2047 parser is fairly liberal in what it accepts. Setting it to GMime.RfcComplianceMode.LOOSE just makes it try harder to deal with garbage input.

set_address_compliance_mode(mode)
Parameters:

mode (GMime.RfcComplianceMode) – a GMime.RfcComplianceMode

Sets the compliance mode that should be used when parsing rfc822 addresses.

In general, you’ll probably want this value to be GMime.RfcComplianceMode.LOOSE (the default) as it allows maximum interoperability with existing (broken) mail clients and other mail software such as sloppily written perl scripts (aka spambots).

Note: Even in GMime.RfcComplianceMode.STRICT mode, the address parser is fairly liberal in what it accepts. Setting it to GMime.RfcComplianceMode.LOOSE just makes it try harder to deal with garbage input.

set_allow_addresses_without_domain(allow)
Parameters:

allow (bool) – True if the parser should allow addresses without a domain or False otherwise

Sets whether the rfc822 address parser should allow addresses without a domain.

In general, you’ll probably want this value to be False (the default) as it allows maximum interoperability with existing (broken) mail clients and other mail software such as sloppily written perl scripts (aka spambots) that do not properly quote the name when it contains a comma.

This option exists in order to allow parsing of mailbox addresses that do not have a domain component. These types of addresses are rare and were typically only used when sending mail to other users on the same UNIX system.

set_fallback_charsets(charsets)
Parameters:

charsets (str) – a None-terminated list of charsets or None for the default list

Sets the fallback charsets to try when decoding 8-bit headers.

Note: It is recommended that the list of charsets start with utf-8 and end with iso-8859-1.

set_parameter_compliance_mode(mode)
Parameters:

mode (GMime.RfcComplianceMode) – a GMime.RfcComplianceMode

Sets the compliance mode that should be used when parsing Content-Type and Content-Disposition parameters.

In general, you’ll probably want this value to be GMime.RfcComplianceMode.LOOSE (the default) as it allows maximum interoperability with existing (broken) mail clients and other mail software such as sloppily written perl scripts (aka spambots).

Note: Even in GMime.RfcComplianceMode.STRICT mode, the parameter parser is fairly liberal in what it accepts. Setting it to GMime.RfcComplianceMode.LOOSE just makes it try harder to deal with garbage input.

set_rfc2047_compliance_mode(mode)
Parameters:

mode (GMime.RfcComplianceMode) – a GMime.RfcComplianceMode

Sets the compliance mode that should be used when parsing rfc2047 encoded words.

In general, you’ll probably want this value to be GMime.RfcComplianceMode.LOOSE (the default) as it allows maximum interoperability with existing (broken) mail clients and other mail software such as sloppily written perl scripts (aka spambots).

Note: Even in GMime.RfcComplianceMode.STRICT mode, the parameter parser is fairly liberal in what it accepts. Setting it to GMime.RfcComplianceMode.LOOSE just makes it try harder to deal with garbage input.