mimekit-ts - v1.0.0
    Preparing search index...

    Class MimeMessage

    Represents a MIME message.

    A message contains message headers and an optional body entity. Address, date, message-id, priority, and body helper properties are synchronized with their corresponding headers.

    Index
    headers: HeaderList

    The message headers.

    compliance: RfcComplianceMode

    C#: internal RfcComplianceMode compliance.

    mboxMarker: Uint8Array<ArrayBufferLike> | null = null

    C#: internal byte[] MboxMarker.

    body: MimeEntity | null = null

    The message body entity.

    • get subject(): string | null

      Gets or sets the message subject.

      Returns string | null

    • set subject(value: string): void

      Sets the message subject.

      Parameters

      • value: string

      Returns void

    • get inReplyTo(): string | null

      Gets or sets the In-Reply-To message id.

      Returns string | null

    • set inReplyTo(value: string | null): void

      Sets the In-Reply-To message id.

      Parameters

      • value: string | null

      Returns void

    • get messageId(): string | null

      Gets or sets the Message-Id value.

      Returns string | null

    • set messageId(value: string): void

      Sets the Message-Id value.

      Parameters

      • value: string

      Returns void

    • get resentMessageId(): string | null

      Gets or sets the Resent-Message-Id value.

      Returns string | null

    • set resentMessageId(value: string): void

      Sets the Resent-Message-Id value.

      Parameters

      • value: string

      Returns void

    • get textBody(): string | null

      Gets the plain text body, if present.

      Returns string | null

    • get htmlBody(): string | null

      Gets the HTML body, if present.

      Returns string | null

    • Gets the body text for a preferred format.

      Parameters

      Returns string | null

      The body text, or null if not available.

    • Gets all message recipients.

      Parameters

      • onlyUnique: boolean = false

        Whether to return only unique mailbox addresses.

      Returns MailboxAddress[]

      The recipient mailboxes.

    • Gets the mailbox that should be used as the signer when signing the message.

      C#: MimeMessage.GetMessageSigner. If either of the Resent-Sender or Resent-From headers are set, the Resent-Sender (or first Resent-From mailbox) is used; otherwise the Sender or first From mailbox is used.

      Returns MailboxAddress | null

      The signer mailbox, or null if no sender has been set.

    • Gets the set of mailboxes a message should be encrypted to.

      C#: MimeMessage.GetEncryptionRecipients — the signer(s) plus every recipient (To/Cc/Bcc, or the Resent-* equivalents), de-duplicated.

      Returns MailboxAddress[]

      The unique recipient mailboxes.

    • Prepares the message body for transport.

      Parameters

      • constraint: EncodingConstraint

        The encoding constraint.

      • maxLineLength: number = 78

        The maximum encoded line length.

      Returns void

    • Serializes the message to a string.

      Returns string

      The serialized message.

    • Releases resources owned by the message body and header lists.

      Returns void

    • Sign the message body in place using the specified S/MIME or OpenPGP context.

      The signer is resolved from the message's Resent-Sender/Resent-From or Sender/From address; the body is replaced with a multipart/signed.

      Parameters

      • ctx: CryptographyContext

        The cryptography context.

      • OptionaldigestAlgo: DigestAlgorithm

        The digest algorithm (defaults to SHA-1, matching C#).

      Returns Promise<void>

    • Encrypt the message body in place to the sender and all recipients. The body is replaced with an application/pkcs7-mime (S/MIME) or multipart/encrypted (PGP/MIME) part, depending on the context.

      Parameters

      • ctx: CryptographyContext

        The cryptography context.

      Returns Promise<void>

    • Sign and then encrypt the message body in place using the specified context.

      Parameters

      • ctx: CryptographyContext

        The cryptography context.

      • OptionaldigestAlgo: DigestAlgorithm

        The digest algorithm (defaults to SHA-1, matching C#).

      Returns Promise<void>