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

    Function fetchAndParseRawEmail

    • Downloads the raw message referenced by an inbound-email payload and parses it.

      The download verifies the declared size and SHA-256 digest and is bounded exactly like fetchRawEmail; the payload's short-lived bearer token is sent in the Authorization header and must not be logged.

      Parameters

      • raw: RawEmail

        The raw_email object from an inbound-email webhook payload.

      • options: FetchRawEmailOptions = {}

        An optional cancellation signal and fetch implementation.

      Returns Promise<ParsedEmail>

      The parsed message. All returned byte arrays are fresh copies.

      Error When the download fails or the message exceeds the parser's nesting or part limits.

      const email = await fetchAndParseRawEmail(event.inboundEmail.raw_email, { signal });
      for (const attachment of email.attachments) {
      console.log(attachment.filename, attachment.content.byteLength);
      }