An awesome addon built on the Denali framework.
Install within your app:
npm install --save denali-mailer
Create a mailer you'd like to use:
// app/mailers/welcome/mailer.js
import { Mailer } from 'denali-mailer';
export default WelcomeMailer extends Mailer {
from = '[email protected]';
to(data) {
return data.email;
}
}
And define your templates in app/mailers/welcome/tempalte.{html,txt}
which get access to the data via ejs.
Use in your action via this.service('mailer')
:
import ApplicationAction from './application';
export default class IndexAction extends ApplicationAction {
serializer = false;
respond() {
let mailer = this.service('mailer');
let data = { email: '[email protected]' };
mailer.send('welcome', data);
return { message: 'Welcome to Denali!' };
}
}
- Clone the repo down
npm install
denali server
- Hit localhost:3000
$ denali test