E-mail providers and templates
Which service sends your auth e-mails, how to connect your own or Sypnia Mail, and how to edit every e-mail in English, Spanish or any language.
Auth sends e-mails: confirm your address, sign in with this link, reset your password. Each project chooses who sends them.
Providers
| Provider | provider | Where | Use it for |
|---|---|---|---|
| SMTP | smtp | engine and Cloud | Any mail service: host, port, user, password, TLS. |
| Resend | resend | engine and Cloud | An API key and a verified domain. |
| Postmark | postmark | engine and Cloud | A server token and a sender signature. |
| Amazon SES (yours) | ses | engine and Cloud | Your own access key, region and verified sender. |
| Sypnia Mail | sypnia_mail | Sypnia Cloud | Sypnia Mail, Sypnia’s sending product: your domain is verified there, and sending counts like any Sypnia Mail e-mail: 10 free a month, then your organization’s credits. |
| The engine’s own sender | sypnia | a self-hosted engine | The sender the operator configured for the whole engine (below). |
| None | none | engine and Cloud | Projects that use only Google or GitHub. No e-mail is sent. |
Sypnia does not send e-mail of its own on behalf of your project. A new project starts without a provider: sign-in with Google or GitHub works at once, and the e-mail flows turn on when you choose a provider, so every e-mail comes from your own domain. Inside Sypnia Cloud, Sypnia Mail is the shortest path: when the domain is in Sypnia Domains, Sypnia Mail writes its records for you. Setting up Amazon SES yourself needs a verified domain and production access from AWS, which takes a request and a day or two; Resend and Postmark are faster to start. Credentials are stored encrypted and never shown again.
Without a provider
Until you choose one, every flow that has to send an e-mail is refused before anything is written or looked up, so the answer never tells whether an address has an account:
| Flow | Endpoint |
|---|---|
| sign-up that needs a confirmation (or «e-mail first», without a password) | POST /auth/v1/signup |
| magic link and 6-digit code | POST /auth/v1/otp (and POST /auth/v1/magiclink) |
| password recovery | POST /auth/v1/recover |
| invite | POST /auth/v1/admin/invite |
| e-mail change | PUT /auth/v1/user with email |
| reauthentication | POST /auth/v1/reauthenticate |
They answer 409:
{ "error": { "code": "email_provider_required", "message": "This project has no e-mail provider. Set one in Auth → E-mail (SMTP, Resend, Postmark or your own SES), or sign people in with Google or GitHub." } }What keeps working: Google and GitHub (SSO), and a sign-up with a password when Require e-mail confirmation is off.
Two places tell you the state:
GET /auth/v1/settings(public) hasemail_ready:falseuntil a provider can send, so your sign-in form can hide the e-mail options.GET /auth/v1/admin/settingshasmail_stateandmail_providers, the providers this project may choose (in Sypnia Cloud:smtp,resend,postmark,ses,sypnia_mail,none). The console’s Auth → E-mail sender shows a warning with Configure a provider and Enable Google or GitHub.
mail_state | Means |
|---|---|
ready | the provider is set and can send |
provider_required | no provider yet |
off | the provider is None |
misconfigured | a provider is chosen but it cannot send: from is missing, or a credential cannot be read |
Choosing a provider
curl -X PATCH https://<ref>.data.sypnia.com/auth/v1/admin/settings \
-H "apikey: $SYPNIA_SECRET_KEY" -H "content-type: application/json" \
-d '{"mail": {"provider": "smtp", "from": "La Espiga <hola@laespiga.co>", "smtp_url": "smtps://user:password@smtp.example.com:465"}}'provider | Also send |
|---|---|
smtp | from, smtp_url (smtps://user:password@host:465, or smtp://user:password@host:587?tls=required for STARTTLS) |
resend | from, api_key |
postmark | from, api_key (the server token) |
ses | from, ses_region, ses_access_key_id, ses_secret_access_key |
sypnia_mail | from: an address on a domain verified in Sypnia Mail |
none | nothing |
With Sypnia Mail you give only the sender:
curl -X PATCH https://<ref>.data.sypnia.com/auth/v1/admin/settings \
-H "apikey: $SYPNIA_SECRET_KEY" -H "content-type: application/json" \
-d '{"mail": {"provider": "sypnia_mail", "from": "La Espiga <hola@laespiga.co>"}}'Sypnia Mail sends from your domain, with its reputation, its suppression list and its delivery events, and each e-mail counts like any other Sypnia Mail e-mail: the 10 free e-mails a month first, then your organization’s credits. You see them in Sypnia Mail next to the rest of your e-mail.
Credentials (smtp_url, api_key, ses_secret_access_key) are sealed when saved and come back as "[redacted]". Sending "[redacted]" back keeps the stored value.
| Error | When |
|---|---|
400 invalid_mail_provider | provider is not one of the values above |
422 provider_not_available | sypnia in a project the engine does not allow to use its own sender (every customer project in Sypnia Cloud) |
400 mail_not_configured | an e-mail is sent while the provider has no from |
400 unknown_setting | a key that is not a setting |
When sending fails
- The provider is down. The flow still succeeds for the person: the one-time token is kept, and the answer is
202with{"status": "email_queued_retry"}. The e-mail is retried 3 times over about 10 minutes from a row insypnia_auth.email_outbox. - An address bounces or complains. It is suppressed for auth e-mails (
sypnia_auth.email_suppressions), and later e-mails to it are skipped.
Self-hosting
A self-hosted engine has one sender of its own (SYPNIA_DATA_MAIL, Mailpit in the Docker quickstart), chosen with "provider": "sypnia", and by default every project may use it: nothing above applies unless you limit it. SYPNIA_DATA_MAIL_DEFAULT_REFS lists the projects allowed to use it (comma-separated; unset or * means all), and SYPNIA_DATA_MAIL_DEFAULT_HOURLY_CAP can cap how many e-mails per hour each of them sends through it. Sypnia Cloud allows it only for its own project. See Configuration.
Templates
| Template | Sent when |
|---|---|
confirmation | someone signs up |
invite | an admin invites someone |
magic_link | someone asks for a sign-in link or code |
recovery | someone forgot their password |
email_change | someone changes their e-mail (to both addresses) |
reauthentication | a sensitive change needs a fresh code |
password_changed | a password was changed |
new_device | a password sign-in comes from a network the person has not signed in from before, and they already had a session |
Each has a subject, an HTML body and a text body, with these variables:
{{ .ConfirmationURL }} the link to open
{{ .Token }} the 6-digit code
{{ .SiteURL }} your app's address (site_url)
{{ .Email }} the person's e-mail
{{ .ProjectName }} the project's name (project_name)
{{ .Data.name }} any key of user_metadataThe engine ships every template in English and Spanish and picks one by user_metadata.locale. You override any of them per language in settings.templates.<template>.<en|es> with a subject, an html and a text; what you leave out keeps the default. GET /auth/v1/admin/settings returns the defaults as template_defaults and the variables as template_variables. The templates are the same whatever provider sends them, Sypnia Mail included.
A template is checked when you save it. Any of these is refused with 400 invalid_template, naming the field:
- broken
{{ … }}syntax; - an unknown variable;
- an e-mail that carries a link or code without
{{ .ConfirmationURL }}or{{ .Token }}. That coversconfirmation,invite,magic_link,recoveryandemail_change;reauthenticationneeds the code. The console shows a live preview and sends a test to your own address.