GMimeMailboxAddress

GMimeMailboxAddress — rfc822 'mailbox' address

Functions

Types and Values

Description

An GMimeMailboxAddress represents what is a typical "email address".

Functions

g_mime_mailbox_address_new ()

GMimeInternetAddress *
g_mime_mailbox_address_new (const char *name,
                            const char *addr,
                            GError **error);

Creates a new GMimeInternetAddress object with the specified name and addr . Leading and trailing Unicode whitespace is removed from name .

The complete addr must be a valid addr-spec or an empty string. The domain's IDN representation is preserved rather than decoded.

Parameters

name

person's name.

[nullable]

addr

person's address

 

error

return location for a GError.

[nullable]

Returns

a new mailbox, or NULL on error.

Note: The name string should be in UTF-8.

[nullable][transfer full]


g_mime_mailbox_address_get_addrspec ()

const char *
g_mime_mailbox_address_get_addrspec (GMimeMailboxAddress *mailbox);

Gets the addr-spec without changing its domain's IDN representation. Use g_mime_mailbox_address_get_address() to encode or decode the domain.

Parameters

mailbox

a GMimeMailboxAddress

 

Returns

the stored addr-spec string.

[transfer none]


g_mime_mailbox_address_set_addrspec ()

gboolean
g_mime_mailbox_address_set_addrspec (GMimeMailboxAddress *mailbox,
                                     const char *addr,
                                     GError **error);

Sets the mailbox address. Invalid input leaves the address unchanged. Empty addresses are allowed. The domain's IDN representation is preserved rather than decoded.

Parameters

mailbox

a GMimeMailboxAddress

 

addr

contact's email address

 

error

return location for a GError.

[nullable]

Returns

whether the address was valid.


g_mime_mailbox_address_get_address ()

char *
g_mime_mailbox_address_get_address (GMimeMailboxAddress *mailbox,
                                    gboolean idn_encode);

Converts the domain without modifying the mailbox. The local part and domain literals are preserved. Mapping failures preserve the stored domain.

Parameters

mailbox

a GMimeMailboxAddress

 

idn_encode

TRUE to IDN-encode the domain, or FALSE to decode it

 

Returns

the converted addr-spec.

[transfer full]


g_mime_mailbox_address_get_local_part ()

char *
g_mime_mailbox_address_get_local_part (GMimeMailboxAddress *mailbox);

Parameters

mailbox

a GMimeMailboxAddress

 

Returns

the local part, including any quotes.

[transfer full]


g_mime_mailbox_address_get_domain ()

char *
g_mime_mailbox_address_get_domain (GMimeMailboxAddress *mailbox,
                                   gboolean idn_encode);

Converts the domain without modifying the mailbox. Domain literals are returned unchanged. Mapping failures preserve the stored domain.

Parameters

mailbox

a GMimeMailboxAddress

 

idn_encode

TRUE to IDN-encode the domain, or FALSE to decode it

 

Returns

the converted domain, or an empty string if absent.

[transfer full]


g_mime_mailbox_address_get_raw_domain ()

const char *
g_mime_mailbox_address_get_raw_domain (GMimeMailboxAddress *mailbox);

Gets the domain without changing its IDN representation. Use g_mime_mailbox_address_get_domain() to encode or decode it.

Parameters

mailbox

a GMimeMailboxAddress

 

Returns

the stored domain, or an empty string if absent.

[transfer none]


g_mime_mailbox_address_is_international ()

gboolean
g_mime_mailbox_address_is_international
                               (GMimeMailboxAddress *mailbox);

Parameters

mailbox

a GMimeMailboxAddress

 

Returns

whether a nonempty mailbox address or its route contains non-ASCII.


g_mime_mailbox_address_get_route ()

GMimeDomainList *
g_mime_mailbox_address_get_route (GMimeMailboxAddress *mailbox);

Parameters

mailbox

a GMimeMailboxAddress

 

Returns

the mutable source-route domains.

[transfer none]


g_mime_mailbox_address_encode_addrspec ()

char *
g_mime_mailbox_address_encode_addrspec
                               (const char *addr);

Normalizes an addr-spec with looser compliance and IDN-encodes its domain. Unparseable input is copied unchanged; local parts and literals are not IDN-encoded.

Parameters

addr

an addr-spec

 

Returns

the encoded addr-spec.

[transfer full]


g_mime_mailbox_address_decode_addrspec ()

char *
g_mime_mailbox_address_decode_addrspec
                               (const char *addr);

Normalizes an addr-spec with looser compliance and decodes IDN domains. Unparseable input is copied unchanged; domain literals are preserved.

Parameters

addr

an addr-spec

 

Returns

the decoded addr-spec.

[transfer full]


g_mime_mailbox_address_parse ()

GMimeInternetAddress *
g_mime_mailbox_address_parse (GMimeParserOptions *options,
                              const char *str,
                              gssize length,
                              GError **error);

Parameters

options

parser options.

[nullable]

str

mailbox text, optionally including a name and source route

 

length

byte length, or -1 for a NUL-terminated string

 

error

return location for a GError.

[nullable]

Returns

exactly one mailbox, or NULL on error.

[nullable][transfer full]

Types and Values

GMimeMailboxAddress

typedef struct _GMimeMailboxAddress GMimeMailboxAddress;

An RFC 2822 Mailbox address.

See Also

GMimeInternetAddress