Skip to content
Cloudflare Docs

Workers Types Interface

WorkersTypesInterface is used 0 times on 0 pages.

Pages which use WorkersTypesInterface

Used 0 times.

Pages

    Partials

      This component uses ts-morph to generate documentation about the methods on an interface from @cloudflare/workers-types, including their parameters and return types.

      Import

      import { WorkersTypesInterface } from "~/components";

      Usage

      ForwardableEmailMessage

      /**
      * An email message that is sent to a consumer Worker and can be rejected/forwarded.
      */
      interface ForwardableEmailMessage extends EmailMessage {
      /**
      * Stream of the email message content.
      */
      readonly raw: ReadableStream<Uint8Array>;
      /**
      * An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
      */
      readonly headers: Headers;
      /**
      * Size of the email message content.
      */
      readonly rawSize: number;
      /**
      * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason.
      * @param reason The reject reason.
      * @returns void
      */
      setReject(reason: string): void;
      /**
      * Forward this email message to a verified destination address of the account.
      * @param rcptTo Verified destination address.
      * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
      * @returns A promise that resolves when the email message is forwarded.
      */
      forward(rcptTo: string, headers?: Headers): Promise<void>;
      /**
      * Reply to the sender of this email message with a new EmailMessage object.
      * @param message The reply message.
      * @returns A promise that resolves when the email message is replied.
      */
      reply(message: EmailMessage): Promise<void>;
      }

      Methods

      setReject()

      Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason.

      Signature
      /**
      * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason.
      * @param reason The reject reason.
      * @returns void
      */
      setReject(reason: string): void;
      Parameters
      • reason string

        The reject reason.

      Returns
      • void

        void

      forward()

      Forward this email message to a verified destination address of the account.

      Signature
      /**
      * Forward this email message to a verified destination address of the account.
      * @param rcptTo Verified destination address.
      * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
      * @returns A promise that resolves when the email message is forwarded.
      */
      forward(rcptTo: string, headers?: Headers): Promise<void>;
      Parameters
      • rcptTo string

        Verified destination address.

      • headers Headers

        A Headers object.

      Returns
      • Promise<void>

        A promise that resolves when the email message is forwarded.

      reply()

      Reply to the sender of this email message with a new EmailMessage object.

      Signature
      /**
      * Reply to the sender of this email message with a new EmailMessage object.
      * @param message The reply message.
      * @returns A promise that resolves when the email message is replied.
      */
      reply(message: EmailMessage): Promise<void>;
      Parameters
      • message EmailMessage

        The reply message.

      Returns
      • Promise<void>

        A promise that resolves when the email message is replied.

      import { WorkersTypesInterface } from "~/components";
      <WorkersTypesInterface name="ForwardableEmailMessage" />

      <WorkersTypesInterface> Props

      name

      required

      type: string

      The name of the TypeScript interface.