Auth e-mails included in every plan with no setup, from your own domain on paid plans, with editable templates and optional custom SMTP.
#Templates
Studio → Authentication → Emails has six templates, each with a subject and an HTML body. The defaults carry your project name; Reset to default brings them back. To send them in each user’s language, see E-mail languages.
| Template | Sent when |
|---|---|
| Confirm signup | A user signs up and Confirm e-mail is on. |
| Invite user | You invite a user. |
| Magic link | A user asks for a magic link or one-time code. |
| Reset password | A user asks for a password reset. |
| Change e-mail address | A user changes their e-mail address. |
| Reauthentication | A user asks for a code before a sensitive change. |
#Variables
| Variable | Value |
|---|---|
{{ .ConfirmationURL }} | The link that confirms the action |
{{ .Token }} | The one-time code |
{{ .TokenHash }} | A hashed token, for building your own link |
{{ .SiteURL }} | Your Site URL |
{{ .RedirectTo }} | The redirect URL of the request |
{{ .Email }} | The user's e-mail address |
{{ .NewEmail }} | The new address (Change e-mail address only) |
{{ .Data }} | The user's metadata |
Each body must contain {{ .ConfirmationURL }}, {{ .Token }} or {{ .TokenHash }}. Subjects are one line of up to 200 characters, bodies up to 50,000 characters.
<h2>Your sign-in code</h2>
<p>Enter <b>{{ .Token }}</b> in the app, or <a href="{{ .ConfirmationURL }}">sign in with one click</a>.</p>#Sender and delivery
Auth e-mails work from the first sign-up, with no SMTP server to set up: StitchDB sends them under your project's name. Each plan includes a number of e-mails per project:
| Free | Pro | Scale | Enterprise | |
|---|---|---|---|---|
| Per month | 500 | 5,000 | 20,000 | 100,000 |
| Per day | 100 | 1,000 | 3,000 | 10,000 |
| Per hour | 30 | 200 | 500 | 2,000 |
| From your own domain | — | Yes | Yes | Yes |
Authentication → Emails → Sending shows how many were sent this month. At 80% of the monthly number the project owner gets an e-mail. When all are used, the project sends at most 1 Auth e-mail per hour until the month ends, so a locked-out user can still reset a password; upgrade or add your own SMTP server to send more.
Addresses that bounce or mark e-mails as spam are tracked. A project with many bounces or complaints, or far more e-mails than its users need, is limited to 1 e-mail per hour while we look at it, and the owner is told why.
#Send from your own domain
On paid plans, Auth e-mails can come from an address on your domain, such as [email protected], still with no SMTP server:
- In Authentication → Emails → Sending, enter the address and the domain, then Add domain. Use a subdomain you only send from (
mail.yourapp.com), so your main domain's mail setup stays as it is. - Add the DNS records shown there (an MX and a TXT record for bounces and SPF, and a TXT record with the DKIM key) at your DNS provider.
- Click Check now, or wait: the domain is checked again automatically for 3 days. Until it is verified, e-mails keep coming from the StitchDB address. Once it is verified, they come from your address.
Remove domain goes back to the StitchDB address; after that you can delete the DNS records.
#Custom SMTP
Optional. To send through your own mail provider, with its limits instead of the plan's, add an SMTP server under Emails → Custom SMTP: host, port (default 587), user name, password, sender address and sender name, plus the minimum interval between e-mails to the same user (default 60 s). The password is stored encrypted. The host must be a public host name (no IP addresses, localhost, .local or .internal), and database ports such as 5432 and 6543 are refused. With your own SMTP the hourly limit defaults to 30 and you can raise it to 100,000.