Skip to content

Mail

henri wraps nodemailer. Configure a transport and henri.mail.send() is ready.

{
"mail": {
"host": "smtp.example.com",
"port": 587,
"secure": false,
"auth": { "user": "apikey", "pass": "..." }
}
}

The mail object is nodemailer’s transport configuration. The transport is verified on boot, so a wrong host or credentials fail early.

Set "mail": "test" to use an Ethereal fake account: nothing is delivered, and the console prints a link to every message. Tests use this automatically.

await henri.mail.send({
from: '"Henri Server" <foo@example.com>',
to: 'bar@example.com, baz@example.com',
subject: 'Hello ✔',
text: 'Hello world?',
html: '<b>Hello world?</b>',
});

henri.mail.nodemailer is the nodemailer package and henri.mail.transporter the configured transport, if you need them directly.