EmailContext

EmailContext

The EmailContext contains all the neccesary data required to generate an email. It is used in the templateContext method of the TemplateConfig object to define which data get passed to the email template engine for interpolation.

Signature

class EmailContext<T extends string = any, E extends VendureEvent = any> {
  public readonly type: T;
  public readonly recipient: string;
  public readonly event: E;
  public readonly languageCode: LanguageCode;
  public readonly channelCode: string;
  public readonly templateVars: { [name: string]: any };
  constructor(options: {
        type: T;
        languageCode: LanguageCode;
        channelCode: string;
        recipient: string;
        event: E;
        templateVars: { [name: string]: any };
    })
}

Members

type

property
type:
T

A string defining the type of email, e.g. “order-confirmation”. See DefaultEmailType for the default types available.

recipient

property
type:
string

The email address of the email recipient.

event

property
type:
E

The VendureEvent which triggered this email

languageCode

property
type:
LanguageCode

The code of the active language when the even was fired.

channelCode

property
type:
string

The code of the Channel from which the event triggering the email was fired.

templateVars

property
type:
{ [name: string]: any }

The variables defined in the {@link EmailOptions} which can be used in the email templates.

constructor

method
type:
(options: { type: T; languageCode: LanguageCode; channelCode: string; recipient: string; event: E; templateVars: { [name: string]: any }; }) => EmailContext
alpha