menu

SiteGenesis / Server-side JS / Class: EmailModel

models/EmailModel~ EmailModel

new EmailModel(template, recipient)

Email helper providing enhanced email functionality

Parameters:
Name Type Description
template String

The template that is rendered and then sent as email.

recipient String

The email address where the text of the rendered template is sent.

Source:
Example
require('~/models/EmailModel').get('mail/resetpasswordemail', Customer.profile.email)
    .setSubject(dw.web.Resource.msg('email.passwordassistance', 'email', null)).send({
         Customer : Customer,
         ResetPasswordToken : ResetPasswordToken
    });

Extends

Methods

(static) sendMail(options) → {dw.system.Status}

Send an email

Parameters:
Name Type Description
options Object
Properties
Name Type Description
recipient String
template String
subject String
from String
context Object
Source:
Returns:

whether the mail was successfully queued (Status.OK) or not (Status.ERROR).

Type
dw.system.Status
Example
```
require('~/cartridge/scripts/models/EmailModel').sendMail({
    recipient: '[email protected]',
    template: 'mail/templatename',
    subject: 'Your order was placed successfully',
    from: '[email protected]',
    context: {
        Order: order
    }
});
````

X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used. By continuing to use this site you are giving us your consent to do this. Privacy Policy.