Transport Options

Transport Options

EmailTransportOptions

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

Signature

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

SMTPTransportOptions

A subset of the SMTP transport options of Nodemailer

Signature

interface SMTPTransportOptions {
  type: 'smtp';
  host: string;
  port: number;
  auth: SMTPCredentials;
  secure?: boolean;
  ignoreTLS?: boolean;
  requireTLS?: boolean;
  name?: string;
  localAddress?: string;
  authMethod?: string;
}

Members

type

property
type:
'smtp'

host

property
type:
string
the hostname or IP address to connect to (defaults to ‘localhost’)

port

property
type:
number
The port to connect to (defaults to 25 or 465)

auth

property
Defines authentication data

secure

property
type:
boolean
Defines if the connection should use SSL (if true) or not (if false)

ignoreTLS

property
type:
boolean
Turns off STARTTLS support if true

requireTLS

property
type:
boolean
Forces the client to use STARTTLS. Returns an error if upgrading the connection is not possible or fails.

name

property
type:
string
Optional hostname of the client, used for identifying to the server

localAddress

property
type:
string
The local interface to bind to for network connections

authMethod

property
type:
string
Defines preferred authentication method, e.g. ‘PLAIN’

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. Mainly intended for use in testing where we don’t care about the email transport.

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.