Skip to main content

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

type

property
'smtp'

logging

property
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({
handler: 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

type

property
'ses'

SendmailTransportOptions

Uses the local Sendmail program to send the email.

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

type

property
'sendmail'

path

property
string

newline

property
string

FileTransportOptions

Outputs the email as an HTML file for development purposes.

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

type

property
'file'

outputPath

property
string

raw

property
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';
}

type

property
'none'

TestingTransportOptions

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

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

type

property
'testing'

onSend

property
(details: EmailDetails) => void

Callback to be invoked when an email would be sent.