@superdevofficial/feathers-mailer
v1.0.12
Published
> Tool for send mails with twig templating
Readme
FeathersMailer
Tool for send mails with twig templating
How to use
You need to configure your mailer according to the environment In a JSON file config :
{
...
"feathersMailer": {
"host": "smtp.mailtrap.io",
"port": 587,
"secure": false,
"auth": { "user": "ce8d0cce23deba", "pass": "5fef8b0fe8e1c6" },
"templatePath": "./src/templates",
"phoneBook": {
"default": "[email protected]"
}
}
}Or in your app.ts
app.configure(FeathersMailer.configure({
environments: {
"host": "smtp.mailtrap.io",
"port": 587,
"secure": false,
"auth": { "user": "ce8d0cce23deba", "pass": "5fef8b0fe8e1c6" },
"templatePath": "./src/templates",
"phoneBook": {
"default": "[email protected]"
}
}
}
}));You must configure your mailer in your app.ts
app.configure(FeathersMailer.configure());Then you can use it in a hook or whenever you want in your applciation
const options: any = {
from: phoneBook.default,
to: phoneBook.default,
subject: 'Nouvelle demande d\'inscription',
template: 'notification-user-temp.twig',
data: Object.assign(context.result, { backofficeUrl: app.get('backofficeUrl') })
};
app.mailer.create(options).send().clean();
return context;
Full configuration
All parametersz to configure FeathersMailer
|index|type|example| |---|---|---|---| |host|string|"smt.mailtrap.io"| |port|number|587| |secure|boolean|false| |auth|object|{ "user": "user", "pass": "pass" }| |templatePath|string|"./src/templates"| |phoneBook|object|{ "admin": "[email protected]" }| |twig|any| Twig configuration from here |
