GMimeParserOptions: GMime 3.0 Reference Manual

## GMimeParserOptions GMimeParserOptions — Parser options |

## Functions

GMimeParserOptions * | g_mime_parser_options_new ()
void | g_mime_parser_options_free ()
GMimeParserOptions * | g_mime_parser_options_clone ()
GMimeParserOptions * | g_mime_parser_options_get_default ()
GMimeRfcComplianceMode | g_mime_parser_options_get_address_compliance_mode ()
void | g_mime_parser_options_set_address_compliance_mode ()
gboolean | g_mime_parser_options_get_allow_addresses_without_domain ()
void | g_mime_parser_options_set_allow_addresses_without_domain ()
GMimeRfcComplianceMode | g_mime_parser_options_get_parameter_compliance_mode ()
void | g_mime_parser_options_set_parameter_compliance_mode ()
GMimeRfcComplianceMode | g_mime_parser_options_get_rfc2047_compliance_mode ()
void | g_mime_parser_options_set_rfc2047_compliance_mode ()
const char ** | g_mime_parser_options_get_fallback_charsets ()
void | g_mime_parser_options_set_fallback_charsets ()

## Types and Values

| GMimeParserOptions
enum | GMimeRfcComplianceMode

## Description

A GMimeParserOptions is used to pass various options to GMimeParser and all of the various other parser functions in GMime.

## Functions

### g_mime_parser_options_new ()

    GMimeParserOptions *
    g_mime_parser_options_new (void);

Creates a new set of GMimeParserOptions.

#### Returns

a newly allocated set of GMimeParserOptions with the default values.

### g_mime_parser_options_free ()

    void
    g_mime_parser_options_free (GMimeParserOptions *options);

Frees a set of GMimeParserOptions.

#### Parameters

options | a GMimeParserOptions |

### g_mime_parser_options_clone ()

    GMimeParserOptions *
    g_mime_parser_options_clone (GMimeParserOptions *options);

Clones a GMimeParserOptions.

#### Parameters

options | a GMimeParserOptions or `NULL`. | [nullable]

#### Returns

a newly allocated GMimeParserOptions.

[transfer full]

### g_mime_parser_options_get_default ()

    GMimeParserOptions *
    g_mime_parser_options_get_default (void);

Gets the default parser options.

#### Returns

the default parser options.

### g_mime_parser_options_get_address_compliance_mode ()

    GMimeRfcComplianceMode
    g_mime_parser_options_get_address_compliance_mode
                                   (GMimeParserOptions *options);

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

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

#### Parameters

options | a GMimeParserOptions or `NULL`. | [nullable]

#### Returns

the compliance mode that is currently set.

### g_mime_parser_options_set_address_compliance_mode ()

    void
    g_mime_parser_options_set_address_compliance_mode
                                   (GMimeParserOptions *options,
                                    GMimeRfcComplianceMode mode);

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

In general, you'll probably want this value to be GMIME_RFC_COMPLIANCE_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_RFC_COMPLIANCE_STRICT mode, the address parser is fairly liberal in what it accepts. Setting it to GMIME_RFC_COMPLIANCE_LOOSE just makes it try harder to deal with garbage input.

#### Parameters

options | a GMimeParserOptions |
mode | a GMimeRfcComplianceMode |

### g_mime_parser_options_get_allow_addresses_without_domain ()

    gboolean
    g_mime_parser_options_get_allow_addresses_without_domain
                                   (GMimeParserOptions *options);

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.

#### Parameters

options | a GMimeParserOptions or `NULL`. | [nullable]

#### Returns

`TRUE` if the address parser should allow addresses without a domain.

### g_mime_parser_options_set_allow_addresses_without_domain ()

    void
    g_mime_parser_options_set_allow_addresses_without_domain
                                   (GMimeParserOptions *options,
                                    gboolean allow);

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.

#### Parameters

options | a GMimeParserOptions |
allow | `TRUE` if the parser should allow addresses without a domain or `FALSE` otherwise |

### g_mime_parser_options_get_parameter_compliance_mode ()

    GMimeRfcComplianceMode
    g_mime_parser_options_get_parameter_compliance_mode
                                   (GMimeParserOptions *options);

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

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

#### Parameters

options | a GMimeParserOptions or `NULL`. | [nullable]

#### Returns

the compliance mode that is currently set.

### g_mime_parser_options_set_parameter_compliance_mode ()

    void
    g_mime_parser_options_set_parameter_compliance_mode
                                   (GMimeParserOptions *options,
                                    GMimeRfcComplianceMode mode);

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_RFC_COMPLIANCE_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_RFC_COMPLIANCE_STRICT mode, the parameter parser is fairly liberal in what it accepts. Setting it to GMIME_RFC_COMPLIANCE_LOOSE just makes it try harder to deal with garbage input.

#### Parameters

options | a GMimeParserOptions |
mode | a GMimeRfcComplianceMode |

### g_mime_parser_options_get_rfc2047_compliance_mode ()

    GMimeRfcComplianceMode
    g_mime_parser_options_get_rfc2047_compliance_mode
                                   (GMimeParserOptions *options);

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

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

#### Parameters

options | a GMimeParserOptions or `NULL`. | [nullable]

#### Returns

the compliance mode that is currently set.

### g_mime_parser_options_set_rfc2047_compliance_mode ()

    void
    g_mime_parser_options_set_rfc2047_compliance_mode
                                   (GMimeParserOptions *options,
                                    GMimeRfcComplianceMode mode);

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

In general, you'll probably want this value to be GMIME_RFC_COMPLIANCE_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_RFC_COMPLIANCE_STRICT mode, the parameter parser is fairly liberal in what it accepts. Setting it to GMIME_RFC_COMPLIANCE_LOOSE just makes it try harder to deal with garbage input.

#### Parameters

options | a GMimeParserOptions |
mode | a GMimeRfcComplianceMode |

### g_mime_parser_options_get_fallback_charsets ()

    const char **
    g_mime_parser_options_get_fallback_charsets
                                   (GMimeParserOptions *options);

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

#### Parameters

options | a GMimeParserOptions or `NULL`. | [nullable]

#### Returns

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

[transfer none]

### g_mime_parser_options_set_fallback_charsets ()

    void
    g_mime_parser_options_set_fallback_charsets
                                   (GMimeParserOptions *options,
                                    const char **charsets);

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.

#### Parameters

options | a GMimeParserOptions |
charsets | a `NULL`-terminated list of charsets or `NULL` for the default list |

## Types and Values

### GMimeParserOptions

    typedef struct _GMimeParserOptions GMimeParserOptions;

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

### enum GMimeRfcComplianceMode

An RFC compliance mode.

#### Members

GMIME_RFC_COMPLIANCE_LOOSE | Attempt to be much more liberal accepting broken and/or invalid formatting. |
GMIME_RFC_COMPLIANCE_STRICT | Do not attempt to be overly liberal in accepting broken and/or invalid formatting. |