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. |
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
- module:models/AbstractModel
- dw.net.Mail
Methods
(static) sendMail(options) → {dw.system.Status}
Send an email
Parameters:
Name | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
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
}
});
````