🚨 Announcing Vendure v2 Beta

Transport Options

EmailTransportOptions

A union of all the possible transport options for sending emails.

Signature

type EmailTransportOptions = | SMTPTransportOptions
    | SendmailTransportOptions
    | FileTransportOptions
    | NoopTransportOptions
    | SESTransportOptions
    | TestingTransportOptions

SMTPTransportOptions

The SMTP transport options of Nodemailer

Signature

interface SMTPTransportOptions extends SMTPTransport.Options {
  type: 'smtp';
  logging?: boolean;
}

Extends

  • SMTPTransport.Options

Members

type

property
type:
'smtp'

logging

property
type:
boolean
default:
false
If true, uses the configured VendureLogger to log messages from Nodemailer as it interacts with the SMTP server.

SESTransportOptions

The SES transport options of Nodemailer

See Nodemailers’s SES docs for more details

Example

 import { SES, SendRawEmailCommand } from '@aws-sdk/client-ses'

 const ses = new SES({
    apiVersion: '2010-12-01',
    region: 'eu-central-1',
    credentials: {
        accessKeyId: process.env.SES_ACCESS_KEY || '',
        secretAccessKey: process.env.SES_SECRET_KEY || '',
    },
 })

 const config: VendureConfig = {
  // Add an instance of the plugin to the plugins array
  plugins: [
    EmailPlugin.init({
      handlers: defaultEmailHandlers,
      templatePath: path.join(__dirname, 'static/email/templates'),
      transport: {
        type: 'ses',
        SES: { ses, aws: { SendRawEmailCommand } },
        sendingRate: 10, // optional messages per second sending rate
      },
    }),
  ],
};

Signature

interface SESTransportOptions extends SESTransport.Options {
  type: 'ses';
}

Extends

  • SESTransport.Options

Members

type

property
type:
'ses'

SendmailTransportOptions

Uses the local Sendmail program to send the email.

Signature

interface SendmailTransportOptions {
  type: 'sendmail';
  path?: string;
  newline?: string;
}

Members

type

property
type:
'sendmail'

path

property
type:
string

newline

property
type:
string

FileTransportOptions

Outputs the email as an HTML file for development purposes.

Signature

interface FileTransportOptions {
  type: 'file';
  outputPath: string;
  raw?: boolean;
}

Members

type

property
type:
'file'

outputPath

property
type:
string

raw

property
type:
boolean

NoopTransportOptions

Does nothing with the generated email. Intended for use in testing where we don’t care about the email transport, or when using a custom EmailSender which does not require transport options.

Signature

interface NoopTransportOptions {
  type: 'none';
}

Members

type

property
type:
'none'

TestingTransportOptions

Forwards the raw GeneratedEmailContext object to a provided callback, for use in testing.

Signature

interface TestingTransportOptions {
  type: 'testing';
  onSend: (details: EmailDetails) => void;
}

Members

type

property
type:
'testing'

onSend

property
type:
(details: EmailDetails) => void
Callback to be invoked when an email would be sent.