Skip to main content

Email Plugin Types

A VendureEvent which also includes a ctx property containing the current RequestContext, which is used to determine the channel and language to use when generating the email.

Signature
type EventWithContext = VendureEvent & { ctx: RequestContext }

A VendureEvent with a RequestContext and a data property which contains the value resolved from the EmailEventHandler.loadData() callback.

Signature
type EventWithAsyncData<Event extends EventWithContext, R> = Event & { data: R }

The final, generated email details to be sent.

Signature
interface EmailDetails<Type extends 'serialized' | 'unserialized' = 'unserialized'> {    from: string;    recipient: string;    subject: string;    body: string;    attachments: Array<Type extends 'serialized' ? SerializedAttachment : Attachment>;    cc?: string;    bcc?: string;    replyTo?: string;}

from

propertystring

recipient

propertystring

subject

propertystring

body

propertystring

attachments

propertyArray<Type extends 'serialized' ? SerializedAttachment : Attachment>

cc

propertystring

bcc

propertystring

replyTo

propertystring

A function used to load async data for use by an EmailEventHandler.

Signature
type LoadDataFn<Event extends EventWithContext, R> = (context: {    event: Event;    injector: Injector;}) => Promise<R>

An object defining a file attachment for an email. Based on the object described here in the Nodemailer docs, but only uses the path property to define a filesystem path or a URL pointing to the attachment file.

Signature
type EmailAttachment = Omit<Attachment, 'raw'> & { path?: string }

The object passed to the TemplateLoader loadTemplate() method.

Signature
interface LoadTemplateInput {    type: string;    templateName: string;    templateVars: any;}

type

propertystring

The type corresponds to the string passed to the EmailEventListener constructor.

templateName

propertystring

The template name is specified by the EmailEventHander's call to the addTemplate() method, and will default to body.hbs

templateVars

propertyany

The variables defined by the globalTemplateVars as well as any variables defined in the EmailEventHandler's setTemplateVars() method.

A function used to define template variables available to email templates. See EmailEventHandler.setTemplateVars().

Signature
type SetTemplateVarsFn<Event> = (    event: Event,    globals: { [key: string]: any },) => { [key: string]: any }

A function used to define attachments to be sent with the email. See https://nodemailer.com/message/attachments/ for more information about how attachments work in Nodemailer.

Signature
type SetAttachmentsFn<Event> = (event: Event) => EmailAttachment[] | Promise<EmailAttachment[]>

A function used to define the subject to be sent with the email.

Signature
type SetSubjectFn<Event> = (    event: Event,    ctx: RequestContext,    injector: Injector,) => string | Promise<string>

Optional address-related fields for sending the email.

Signature
interface OptionalAddressFields {    cc?: string;    bcc?: string;    replyTo?: string;}

cc

propertystring

Comma separated list of recipients email addresses that will appear on the Cc: field

bcc

propertystring

Comma separated list of recipients email addresses that will appear on the Bcc: field

replyTo

propertystring

An email address that will appear on the Reply-To: field

A function used to set the OptionalAddressFields.

Signature
type SetOptionalAddressFieldsFn<Event> = (    event: Event,) => OptionalAddressFields | Promise<OptionalAddressFields>

A function used to set the EmailMetadata.

Signature
type SetMetadataFn<Event> = (event: Event) => EmailMetadata | Promise<EmailMetadata>

Metadata that can be attached to an email via the EmailEventHandler.setMetadata() method.

Signature
type EmailMetadata = Record<string, any>
Was this chapter helpful?
Report Issue
Edited Feb 4, 2026·Edit this page