MailboxAddressIsInternational Property

Get whether the address is an international address.

Definition

Namespace: MimeKit
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
public bool IsInternational { get; }

Property Value

Boolean
if the address is an international address; otherwise, .

Remarks

International addresses are addresses that contain international characters in either their local-parts or their domains.

For more information, see section 3.2 of rfc6532.

Example

C#
                    public static void PrintInternationalAddress ()
{
    var mailbox = new MailboxAddress ("Jörg Müller", "jörg@bücher.example");

    // An address is international if the local-part or domain contain non-ASCII characters.
    Console.WriteLine ("IsInternational: {0}", mailbox.IsInternational); // True

    // GetAddress (true) converts the domain into its ASCII-compatible (punycode) form.
    Console.WriteLine (mailbox.GetAddress (true)); // jörg@xn--bcher-kva.example

    // When encoding for use in a message header, the name is rfc2047-encoded and the domain
    // is punycode-encoded. If the SMTP server supports the SMTPUTF8 extension, enable the
    // FormatOptions.International option in order to leave the UTF-8 text as-is.
    var options = FormatOptions.Default.Clone ();
    options.International = true;

    // =?utf-8?b?SsO2cmcgTcO8bGxlcg==?= <jörg@xn--bcher-kva.example>
    Console.WriteLine (mailbox.ToString (FormatOptions.Default, true));

    // Jörg Müller <jörg@bücher.example>
    Console.WriteLine (mailbox.ToString (options, true));
}
                  

See Also