Skip to main content

Transactional Emails

Sending Transactional Emails

The /api/v1/notifications/send/:type endpoint is configured to send a variety of email types. You start with an example using the invite transactional email invitation type, which is used whenever an email is invited to join a tenant.

You can extend these with your own using the sendEmail function. Below is an example of the invite type's call:

// src/api/notifciations.ts

const {data} = // ...
// ...
const parsedLocale = locale.split("-")[0];
const templateName = `${invitationType}-${parsedLocale}` as TemplateName;
const emailData = {
inviteTenant: data.tenant_name,
inviteUrl: `${SITE_URL}/invite/${invitation.token}`,
};
await sendEmail(c, data.invited_user_email, templateName, emailData);

Supported Transactional Email Providers

Out of the box, the following email providers are supported in the backend (see src/mail.ts for full code):

If you have strict EU data requirements, Mailjet is recommended. Otherwise, any of these are perfectly valid, with good deliverability rates and affordable pricing.

note

When using aws as the email provider, you must set a corresponding AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_REGION environment variables for the backend. This access id must have the correct permissions for sending your target region.