Email Plugin Types
EventWithContext
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.
type EventWithContext = VendureEvent & { ctx: RequestContext }
EventWithAsyncData
A VendureEvent with a RequestContext and a data
property which contains the
value resolved from the EmailEventHandler.loadData()
callback.
type EventWithAsyncData<Event extends EventWithContext, R> = Event & { data: R }
EmailDetails
The final, generated email details to be sent.
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
string
recipient
string
subject
string
body
string
attachments
Array<Type extends 'serialized' ? SerializedAttachment : Attachment>
cc
string
bcc
string
replyTo
string
LoadDataFn
A function used to load async data for use by an EmailEventHandler.
type LoadDataFn<Event extends EventWithContext, R> = (context: {
event: Event;
injector: Injector;
}) => Promise<R>
EmailAttachment
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.
type EmailAttachment = Omit<Attachment, 'raw'> & { path?: string }
SetTemplateVarsFn
A function used to define template variables available to email templates. See EmailEventHandler.setTemplateVars().
type SetTemplateVarsFn<Event> = (
event: Event,
globals: { [key: string]: any },
) => { [key: string]: any }
SetAttachmentsFn
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.
type SetAttachmentsFn<Event> = (event: Event) => EmailAttachment[] | Promise<EmailAttachment[]>
OptionalAddressFields
Optional address-related fields for sending the email.
interface OptionalAddressFields {
cc?: string;
bcc?: string;
replyTo?: string;
}
cc
string
Comma separated list of recipients email addresses that will appear on the Cc: field
bcc
string
Comma separated list of recipients email addresses that will appear on the Bcc: field
replyTo
string
An email address that will appear on the Reply-To: field
SetOptionalAddressFieldsFn
A function used to set the OptionalAddressFields.
type SetOptionalAddressFieldsFn<Event> = (
event: Event,
) => OptionalAddressFields | Promise<OptionalAddressFields>