Email Notifications

You can send email notifications to your users from anywhere in your application.

Emails use a JSON template for content - no need to wrestle with HTML tables. The JSON is then injected into an email template located in the /emails directory.

await mail.send({
template: 'welcome',
content: {
name: 'John',
plan: 'startup',
price: '$49'
}
});

You can also use a custom HTML template by passing the name of the file as a custom value.

Sending Notifications to Yourself

If you wish to send a notification to yourself, you can use the mail utility endpoint:

POST /api/utility/mail
// accepts
{
name: 'from-name',
email: 'from-email-address',
message: 'message body'
}

This will send an email to the address stored in SUPPORT_EMAIL environment variable. You can see an example of this in the /help view.

Using Other Mail Providers

The mailing logic is isolated in model/mail with a raw API call, so if you'd like to use a provider other than Mailgun, you can simply update this API call in one location.