Skip to content

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.

Applies to EngineCloud
View as Markdown
On this page
  1. Providers
  2. Without a provider
  3. Choosing a provider
  4. When sending fails
  5. Self-hosting
  6. Templates

Auth sends e-mails: confirm your address, sign in with this link, reset your password. Each project chooses who sends them.

Providers

ProviderproviderWhereUse it for
SMTPsmtpengine and CloudAny mail service: host, port, user, password, TLS.
Resendresendengine and CloudAn API key and a verified domain.
Postmarkpostmarkengine and CloudA server token and a sender signature.
Amazon SES (yours)sesengine and CloudYour own access key, region and verified sender.
Sypnia Mailsypnia_mailSypnia CloudSypnia 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 sendersypniaa self-hosted engineThe sender the operator configured for the whole engine (below).
Nonenoneengine and CloudProjects 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:

FlowEndpoint
sign-up that needs a confirmation (or «e-mail first», without a password)POST /auth/v1/signup
magic link and 6-digit codePOST /auth/v1/otp (and POST /auth/v1/magiclink)
password recoveryPOST /auth/v1/recover
invitePOST /auth/v1/admin/invite
e-mail changePUT /auth/v1/user with email
reauthenticationPOST /auth/v1/reauthenticate

They answer 409:

JSON
{ "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) has email_ready: false until a provider can send, so your sign-in form can hide the e-mail options.
  • GET /auth/v1/admin/settings has mail_state and mail_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_stateMeans
readythe provider is set and can send
provider_requiredno provider yet
offthe provider is None
misconfigureda provider is chosen but it cannot send: from is missing, or a credential cannot be read

Choosing a provider

Terminal
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"}}'
providerAlso send
smtpfrom, smtp_url (smtps://user:password@host:465, or smtp://user:password@host:587?tls=required for STARTTLS)
resendfrom, api_key
postmarkfrom, api_key (the server token)
sesfrom, ses_region, ses_access_key_id, ses_secret_access_key
sypnia_mailfrom: an address on a domain verified in Sypnia Mail
nonenothing

With Sypnia Mail you give only the sender:

Terminal
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.

ErrorWhen
400 invalid_mail_providerprovider is not one of the values above
422 provider_not_availablesypnia in a project the engine does not allow to use its own sender (every customer project in Sypnia Cloud)
400 mail_not_configuredan e-mail is sent while the provider has no from
400 unknown_settinga 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 202 with {"status": "email_queued_retry"}. The e-mail is retried 3 times over about 10 minutes from a row in sypnia_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

TemplateSent when
confirmationsomeone signs up
invitean admin invites someone
magic_linksomeone asks for a sign-in link or code
recoverysomeone forgot their password
email_changesomeone changes their e-mail (to both addresses)
reauthenticationa sensitive change needs a fresh code
password_changeda password was changed
new_devicea 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:

Text
{{ .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_metadata

The 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 covers confirmation, invite, magic_link, recovery and email_change; reauthentication needs the code. The console shows a live preview and sends a test to your own address.
  1. Providers
  2. Without a provider
  3. Choosing a provider
  4. When sending fails
  5. Self-hosting
  6. Templates

    Search pages, sections and terms