edgeport - v1.0.6
    Preparing search index...

    Function formatEmailAddress

    • Formats an address, wrapping it in a display name when one is given.

      The inverse of parseEmailAddress: a bare address is returned unchanged, and a named address becomes Name <address>. A display name containing characters that would break the header syntax (",<>@()) is emitted as a quoted string.

      Parameters

      • addr: { address: string; name?: string }

        The address plus an optional display name.

      Returns string

      The formatted address string.

      1.0.4

      import { formatEmailAddress } from 'edgeport/util';

      formatEmailAddress({ address: 'ada@example.com' }); // 'ada@example.com'
      formatEmailAddress({ name: 'Doe, John', address: 'j@x.com' }); // '"Doe, John" <j@x.com>'