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

    Function fetchRawEmail

    • Downloads the raw RFC 822 message referenced by a DELIVER_WEBHOOK payload.

      The payload's short-lived bearer token is sent in the Authorization header, and the downloaded bytes are verified against the declared size and SHA-256 digest. Treat raw_email.access_token as a secret and do not log it.

      Parameters

      • raw: RawEmail

        The raw_email object from an inbound-email payload.

      • options: FetchRawEmailOptions = {}

        An optional cancellation signal and fetch implementation.

      Returns Promise<Uint8Array<ArrayBufferLike>>

      The exact message bytes.

      Error When the URL or token is empty, the response is unsuccessful, or the downloaded bytes fail the size or digest check.

      const bytes = await fetchRawEmail(event.inboundEmail.rawEmail, { signal });