@mxraven/mail - v0.2.0
    Preparing search index...

    Class Message

    A mutable, chainable builder for an email message.

    Chained methods return the receiver, so a message is normally composed in a single expression. A Message is not safe for concurrent use. It can be sent repeatedly; each send serializes the current state.

    const message = new Message()
    .from("Acme <noreply@acme.example>")
    .to("customer@example.com")
    .subject("Your receipt")
    .text("Thanks for your order.")
    .html("<p>Thanks for your order.</p>");
    Index
    • Appends an attachment.

      The data is retained by reference until the message is built. Callers must not mutate it in the meantime.

      Parameters

      Returns this

    • Appends a file attachment with an application/octet-stream content type.

      Parameters

      • filename: string
      • data: Uint8Array

      Returns this

    • Appends an inline attachment referenced by contentId, for example from cid: HTML.

      Parameters

      • filename: string
      • contentId: string
      • data: Uint8Array

      Returns this

    • Adds envelope recipients without a visible Bcc header.

      Parameters

      • addresses: string | readonly string[]

      Returns this

    • Adds envelope and Cc header recipients.

      Parameters

      • addresses: string | readonly string[]

      Returns this

    • Sets the Date header. When unset, the time of sending is used.

      Parameters

      • date: Date

      Returns this

    • Sets the envelope sender and the From header.

      Parameters

      • address: string

      Returns this

    • Appends a custom header.

      Parameters

      • name: string
      • value: string

      Returns this

    • Sets the HTML body.

      When both a text and an HTML body are set, the message is sent as multipart/alternative.

      Parameters

      • body: string

      Returns this

    • Sets the In-Reply-To header for threading.

      Parameters

      • id: string

      Returns this

    • Sets the Message-ID header. The value is wrapped in angle brackets when needed.

      Parameters

      • id: string

      Returns this

    • Uses a null reverse-path while keeping the From header.

      It is intended for bounce and other auto-generated messages. A From header is still required for a valid message.

      Returns this

    • Sets the References header for threading.

      Parameters

      • ids: string | readonly string[]

      Returns this

    • Sets the Reply-To header.

      Parameters

      • address: string

      Returns this

    • Sets the Sender header, required when From contains more than one mailbox.

      Parameters

      • address: string

      Returns this

    • Sets the Subject header. Non-ASCII subjects are RFC 2047 encoded.

      Parameters

      • subject: string

      Returns this

    • Sets the plain-text body.

      When both a text and an HTML body are set, the message is sent as multipart/alternative.

      Parameters

      • body: string

      Returns this

    • Adds envelope and To header recipients.

      Parameters

      • addresses: string | readonly string[]

      Returns this