## CamelInternetAddress

CamelInternetAddress

## Functions

CamelInternetAddress * | camel_internet_address_new ()
gint | camel_internet_address_add ()
gboolean | camel_internet_address_get ()
gint | camel_internet_address_find_name ()
gint | camel_internet_address_find_address ()
void | camel_internet_address_ensure_ascii_domains ()
gboolean | camel_internet_address_sanitize_ascii_domain ()
gchar * | camel_internet_address_encode_address ()
gchar * | camel_internet_address_format_address ()

## Object Hierarchy

        GObject
        ╰── CamelAddress
            ╰── CamelInternetAddress

## Description

## Functions

### camel_internet_address_new ()

    CamelInternetAddress *
    camel_internet_address_new (void);

Create a new CamelInternetAddress object.

#### Returns

a new CamelInternetAddress object

### camel_internet_address_add ()

    gint
    camel_internet_address_add (CamelInternetAddress *addr,
                                const gchar *name,
                                const gchar *address);

Add a new internet address to `addr` .

#### Parameters

addr | a CamelInternetAddress object |
name | name associated with the new address |
address | routing address associated with the new address |

#### Returns

the index of added entry

### camel_internet_address_get ()

    gboolean
    camel_internet_address_get (CamelInternetAddress *addr,
                                gint index,
                                const gchar **namep,
                                const gchar **addressp);

Get the address at `index` .

#### Parameters

addr | a CamelInternetAddress object |
index | address's array index |
namep | holder for the returned name, or `NULL`, if not required. | [out][optional][nullable][transfer none]
addressp | holder for the returned address, or `NULL`, if not required. | [out][optional][nullable][transfer none]

#### Returns

`TRUE` if such an address exists, or `FALSE` otherwise

### camel_internet_address_find_name ()

    gint
    camel_internet_address_find_name (CamelInternetAddress *addr,
                                      const gchar *name,
                                      const gchar **addressp);

Find address by real name.

#### Parameters

addr | a CamelInternetAddress object |
name | name to lookup |
addressp | holder for address part, or `NULL`, if not required. | [out][optional][nullable][transfer none]

#### Returns

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

### camel_internet_address_find_address ()

    gint
    camel_internet_address_find_address (CamelInternetAddress *addr,
                                         const gchar *address,
                                         const gchar **namep);

Find an address by address.

#### Parameters

addr | a CamelInternetAddress object |
address | address to lookup |
namep | holder for the matching name, or `NULL`, if not required. | [out][optional][nullable][transfer none]

#### Returns

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

### camel_internet_address_ensure_ascii_domains ()

    void
    camel_internet_address_ensure_ascii_domains
                                   (CamelInternetAddress *addr);

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).

#### Parameters

addr | a CamelInternetAddress |

Since: 3.16

### camel_internet_address_sanitize_ascii_domain ()

    gboolean
    camel_internet_address_sanitize_ascii_domain
                                   (CamelInternetAddress *addr);

Checks the addresses in `addr` for any suspicious characters in the domain name and coverts those domains into their representation. In contrast to `camel_internet_address_ensure_ascii_domains()`, this converts the domains into ASCII only when needed, as returned by `camel_hostname_utils_requires_ascii()`.

#### Parameters

addr | a CamelInternetAddress |

#### Returns

`TRUE`, when converted at least one address

Since: 3.44

### camel_internet_address_encode_address ()

    gchar *
    camel_internet_address_encode_address (gint *len,
                                           const gchar *name,
                                           const gchar *addr);

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

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

#### Parameters

len | the length of the line the address is being appended to. | [nullable]
name | the unencoded real name associated with the address |
addr | the routing address |

#### Returns

the encoded address

### camel_internet_address_format_address ()

    gchar *
    camel_internet_address_format_address (const gchar *name,
                                           const gchar *addr);

Function to format a single address, suitable for display.

#### Parameters

name | a name, quotes may be stripped from it |
addr | an rfc822 routing address |

#### Returns

a nicely formatted string containing the rfc822 address