# Sypnia Mail documentation > Sypnia Mail sends the e-mails your app needs (confirmations, receipts, password resets, alerts) and gives your domain real inboxes: hola@, soporte@, one per person or shared by a team. Your domain is set up for you, bounces and complaints are handled, every e-mail can be followed from sent to delivered, and your inboxes are read in Sypnia, in your mail app or by an agent. Every page of the documentation follows, in reading order. Each one starts with its title and its address. --- ## Start here > What Sypnia Mail is, how it works, what is open source and what is Sypnia Cloud, and the quickstarts. Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service). Source: https://mail.docs.sypnia.com/start/ For agents: Section index for Sypnia Mail: transactional e-mail on Amazon SES (or SMTP when self-hosted): sending domains with DKIM/SPF/DMARC (automatic with Sypnia Domains), send API and SMTP relay, templates, events and webhooks, suppression list, inbound parsing, deliverability guardrails; used by Sypnia Data auth as a provider. Sypnia Mail sends the e-mails your app needs and tells you what happened to each one. Your domain is verified once, templates live with your project, bounces and complaints are handled, and you can receive e-mail at your domain too. > **Note: Sypnia uses it** > > is a shared inbox in Sypnia Mail, and every e-mail the Sypnia suite sends goes out through it. - **\[Engine]** **The Sypnia Mail engine** is open source. It sends through **your** Amazon SES account or any SMTP server. - **\[Cloud]** **Sypnia Cloud** runs the same engine with Sypnia's Amazon SES account, the console, deliverability guardrails, and billing in credits. * [What Sypnia Mail is](/start/what-it-is/): Transactional e-mail for your app: your domain, templates, events, inbound mail, and the reputation that keeps it out of spam. * [How it works](/start/how-it-works/): From a send call to a delivered e-mail and the event that tells you so. * [Open source and Sypnia Cloud](/start/open-source-and-cloud/): What the open-source engine does with your SES account, and what Sypnia Cloud adds. * [Quickstart: Sypnia Cloud](/start/quickstart-cloud/): Verify your domain, create a template and send your first e-mail. * [Quickstart: self-host](/start/quickstart-self-host/): Run the engine with Docker and Mailpit, then point it at your SES account. * [How Sypnia uses it](/start/how-sypnia-uses-it/): Telemetry, the pilot, sends its alerts and daily summaries with Sypnia Mail, and Sypnia answers its own support mail in a shared inbox. --- ## What Sypnia Mail is > Transactional e-mail for your app: your domain, templates, events, inbound mail, and the reputation that keeps it out of spam. Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service). Source: https://mail.docs.sypnia.com/start/what-it-is/ For agents: What Sypnia Mail is: sending domains (DKIM, SPF, DMARC), send API and SMTP relay, templates (variables, versions, preview, per language), events (sent/delivered/bounced/complained/opened/clicked) in log and webhooks, suppression list, inbound to webhook as JSON, deliverability guardrails; transactional only (no newsletters/bulk on shared reputation); Data auth can use Mail as provider; Domains sets records; Files attachments by path. > **In plain words** > > Your app needs to send e-mails: «confirm your account», «your order is ready», «here is your receipt». Mail sends them from your own address, makes sure they reach the inbox, and tells you if one bounced. ### What you get | What | In one line | | --------------------- | -------------------------------------------------------------------------------------------------------------------- | | **Sending domains** | Your domain proven with DKIM, SPF and DMARC, so inboxes trust your mail | | **Send API and SMTP** | Send from code with one call, or from any app that speaks SMTP | | **Templates** | Stored with your project, with variables, versions, a preview, and a version per language | | **Events** | Sent, delivered, bounced, complained, opened, clicked: in the log and pushed to your webhook | | **Suppression list** | Addresses that bounced or complained are not sent to again | | **Inbound** | E-mail sent to your domain arrives at your webhook as JSON | | **Mailboxes** | Real inboxes at your domain, personal or shared by a team, read in Sypnia's webmail, in your mail app or by an agent | | **Deliverability** | Warm-up, limits and guardrails that protect your reputation and everyone else's | ### Made for transactional e-mail Mail is for messages a person expects because of something they did: sign-ups, receipts, alerts, password resets. Newsletters and bulk marketing to lists are **not** sent on Sypnia's shared reputation; [Deliverability](https://mail.docs.sypnia.com/deliverability) explains why and what to do instead. ### With the rest of Sypnia - **Sypnia Data** uses Mail for its auth e-mails when you choose it as the project's provider: confirmations and magic links leave from your domain, with your templates. - **Sypnia Domains** sets up the records of a sending domain for you. - **Sypnia Files** attachments can be referenced by path. - **Sypnia Cases** and **Sypnia Telemetry**: a send can name its use case, and its delivery, bounce or complaint shows up in that case's trace ([Use cases and traces](https://mail.docs.sypnia.com/events/use-cases)). --- ## How it works > From a send call to a delivered e-mail and the event that tells you so. Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service). Source: https://mail.docs.sypnia.com/start/how-it-works/ For agents: How Mail works: POST https://mail.api.sypnia.com/v1/emails (key, verified sender domain, suppression check, limits → 202 with id) → render template to HTML + text, optional tracking, project queue respecting plan rate and warm-up → Amazon SES with your DKIM and return path → events (delivery, bounce, complaint) recorded, hard bounces/complaints suppressed, webhooks. SMTP relay smtp.mail.sypnia.com 587/465; templates/events/suppressions in Postgres; bodies kept for retention. #### 1. Your app sends `POST https://mail.api.sypnia.com/v1/emails` with a template and its data, or a subject and a body. The API checks the key, that the sender's domain is verified, that recipients are not on the suppression list, and the project's limits, then answers `202` with the e-mail's id. #### 2. Mail renders and queues The template is rendered with the data into HTML and plain text, tracking is added if you turned it on, and the message waits in the project's queue, which respects the rate your plan and warm-up allow. #### 3. Amazon SES delivers The message is handed to Amazon SES, signed with your domain's DKIM key, with your domain's return path, and SES delivers it to the recipient's server. #### 4. Events come back SES reports delivery, bounces and complaints; Mail records each as an event on the e-mail, adds hard bounces and complaints to the suppression list, and sends the events to your webhook. ### Where things live | Thing | Where | | ------------------------------- | ------------------------------------------------------------------------------------ | | The API | `https://mail.api.sypnia.com/v1` **\[Cloud]** | | The SMTP relay | `smtp.mail.sypnia.com`, ports 587 and 465 **\[Cloud]** | | Templates, events, suppressions | the engine's Postgres | | Message bodies | kept for the plan's retention, then deleted; events are kept longer without the body | --- ## Open source and Sypnia Cloud > What the open-source engine does with your SES account, and what Sypnia Cloud adds. Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service). Source: https://mail.docs.sypnia.com/start/open-source-and-cloud/ For agents: Mail engine vs Cloud: engine sends via your SES (starts in sandbox; you request production access) or any SMTP, reputation yours, inbound with your SES rules, no console; Cloud uses Sypnia SES already out of sandbox (or yours via connection), shared reputation protected by guardrails, inbound included, console; same API/SDK/SMTP/templates. | | Engine **\[Engine]** | Sypnia Cloud **\[Cloud]** | | ------------- | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | | Sends through | your Amazon SES account, or any SMTP server | Sypnia's Amazon SES account (out of the sandbox), or yours | | SES sandbox | your new SES account starts in the sandbox: you request production access from AWS | already out | | Reputation | yours alone | shared and protected by guardrails; yours if you connect your SES account | | Inbound | with your SES receiving rules | included | | Console | none; the API, CLI and MCP | the console: templates editor, event log, domain setup | | License | open source: the engine under AGPL-3.0, `@sypnia/mail` under MIT | a hosted service, paid in credits | The API, the SDK, the SMTP relay settings and the templates are the same, so you can move either way. --- ## Quickstart: Sypnia Cloud > Verify your domain, create a template and send your first e-mail. Applies to: Sypnia Cloud (paid service). Source: https://mail.docs.sypnia.com/start/quickstart-cloud/ For agents: Mail Cloud quickstart: npx @sypnia/mail login; domains add laespiga.co (automatic records with Sypnia Domains, else 3 DKIM CNAMEs, return-path MX+TXT, DMARC TXT); templates create --subject --html; keys create server --scope send; createMail({apiKey}).send({from, to, template, data}); mail events --email shows queued → sent → delivered. Needs a domain of your own (no shared sending domain); 10 free e-mails a month per organization, then credits; new domains start with a low quota. You need a domain of your own: Mail sends only from domains you verified, the free e-mails included. Every organization can send 10 e-mails a month free; beyond that, e-mails are paid from credits. A new domain starts with a low daily quota that grows with good activity ([Reputation and warm-up](https://mail.docs.sypnia.com/deliverability/reputation-and-warm-up)). #### 1. Add your domain ```bash npx @sypnia/mail login npx @sypnia/mail domains add laespiga.co ``` If the domain is in [Sypnia Domains](https://domains.sypnia.com), the records are added for you. Otherwise the command prints them (three DKIM `CNAME`s, the return-path `MX` and `TXT`, and a DMARC `TXT`) and waits for them. **You should see:**`laespiga.co verified: DKIM ✓ SPF ✓ DMARC ✓`. #### 2. Create a template ```bash npx @sypnia/mail templates create order-ready --subject "Tu pedido {{order}} está listo" --html ./order-ready.html ``` #### 3. Create a key and send ```bash npx @sypnia/mail keys create server --scope send ``` ```ts import { createMail } from '@sypnia/mail/server'; const mail = createMail({ apiKey: process.env.SYPNIA_MAIL_KEY! }); const { id } = await mail.send({ from: 'La Espiga ', to: 'ana@example.com', template: 'order-ready', data: { name: 'Ana', order: '#1042' } }); ``` #### 4. See what happened ```bash npx @sypnia/mail events --email ``` **You should see:**`queued → sent → delivered`. --- ## Quickstart: self-host > Run the engine with Docker and Mailpit, then point it at your SES account. Applies to: the Sypnia engine (open source, self-hosted). Source: https://mail.docs.sypnia.com/start/quickstart-self-host/ For agents: Mail self-host quickstart: clone sypnia-mail, docker compose up (engine :7600, Postgres, Mailpit :8025 catches mail); set SYPNIA_MAIL_TRANSPORT=ses (IAM role or keys) or smtp; new SES accounts are in the sandbox (verified recipients only, 200/day) — request production access in your SES console. ```bash git clone https://github.com/sespinosav/sypnia-mail && cd sypnia-mail docker compose up # engine on :7600, Postgres, and Mailpit on :8025 as the outbox ``` Mailpit catches every message so you can try sending without delivering anything. To deliver for real, set `SYPNIA_MAIL_TRANSPORT=ses` with an IAM role or keys for your account, or `smtp` with your server, and restart. > **Warning** > > A new Amazon SES account is in the > > **sandbox** > > : it can only send to addresses you have verified, up to 200 a day. Request production access in the SES console of your account; AWS reviews it, usually within a day. > **Note** > > The repository lives in Sypnia Git, like all of Sypnia's code, with a mirror on GitHub at the address above. --- ## How Sypnia uses it > Telemetry, the pilot, sends its alerts and daily summaries with Sypnia Mail, and Sypnia answers its own support mail in a shared inbox. Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service). Source: https://mail.docs.sypnia.com/start/how-sypnia-uses-it/ For agents: Dogfooding: Telemetry (the pilot, built on Sypnia end to end) sends its Cloud alert e-mails and daily summaries through Sypnia Mail's send API from alerts@telemetry.sypnia.com (domain verified in Mail, records written by Sypnia Domains), templates problem-alert and daily-summary (versioned, English and Spanish), an idempotency key per alert so a retry never sends twice, case send-alert / send-daily-summary on each send, bounces suppressed and visible in the case's trace. Sign-in e-mails of Telemetry's Data project go through the sypnia_mail provider. Sypnia's own mail leaves from a region apart from customers' mail. support@sypnia.com is a shared inbox in Sypnia Mail; Sypnia Agent drafts replies, a person sends; requests for missing features become Cases proposals. Self-hosted Telemetry engines can use Sypnia Mail as a sender on their alert webhook. Rest of the suite: Data sign-in e-mails (sypnia_mail), App's approval e-mails after 30 minutes unseen, Domains renewal reminders, Agent task updates, Learn, account e-mails from auth.sypnia.com. Telemetry is the pilot of the Sypnia suite: it is built on Sypnia from end to end and uses every Sypnia product. This is how it uses Sypnia Mail. ### How Telemetry uses Sypnia Mail | What Telemetry sends or receives | How it goes through Mail | | ---------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | | **An alert** («3 people tried to pay today and could not») | the [send API](https://mail.docs.sypnia.com/sending/send-api), template `problem-alert`, from `alerts@telemetry.sypnia.com`, under the case `send-alert` | | **The daily summary** | template `daily-summary`, under the case `send-daily-summary` | | **Sign-in e-mails** of the Telemetry console | Telemetry's [Sypnia Data](https://data.docs.sypnia.com/auth/email-providers-and-templates) project uses the `sypnia_mail` provider, from the same domain | | **Support**: questions people send to `support@sypnia.com` | a [shared inbox](https://mail.docs.sypnia.com/mailboxes/inboxes-and-addresses) the team reads in the webmail | - **Its own domain, set up by Domains.** `telemetry.sypnia.com` is verified in Mail, and [Sypnia Domains](https://domains.docs.sypnia.com/connect/mail) wrote its DKIM, SPF and DMARC records. - **Templates in two languages.** `problem-alert` and `daily-summary` have an English and a Spanish version, chosen by each person's language, and every change is a new [version](https://mail.docs.sypnia.com/sending/templates) that can be rolled back. - **Never twice.** Each alert carries an idempotency key made from the problem and the moment it crossed its threshold, so a retry of the worker never sends the same alert again. - **Bounces stop on their own.** An address that bounces is suppressed, the member sees a notice in the console, and the bounce shows up in the trace of `send-alert` in Telemetry itself. - **Kept apart from customers.** Sypnia's own e-mails leave from a region of their own, so nothing a customer sends can delay an alert ([Reputation](https://mail.docs.sypnia.com/deliverability/reputation-and-warm-up)). - **An agent at the support inbox.** Sypnia Agent sorts `support@sypnia.com` and drafts answers; a person reads and sends each one. When someone asks for something Telemetry does not do, the message becomes a proposal in Cases ([Agents](https://mail.docs.sypnia.com/mailboxes/agents)). - **Self-hosted too.** A self-hosted Telemetry engine sends no e-mail by itself; its alert webhook can call a self-hosted or Cloud Sypnia Mail with the same two templates, as one more recipe next to Amazon SES and SMTP. ### The rest of the suite | Product or site | What it sends with Sypnia Mail | | ------------------------------------------- | -------------------------------------------------------------------------------------------------------- | | [Data](https://data.docs.sypnia.com/) | sign-in e-mails of every project that chooses the `sypnia_mail` provider, Sypnia's own projects included | | [App](https://app.docs.sypnia.com/) | an approval nobody has seen for 30 minutes, by e-mail | | [Domains](https://domains.docs.sypnia.com/) | renewal reminders and notices about a domain's state | | [Agent](https://agent.docs.sypnia.com/) | when a task is waiting for a person or has finished | | The Sypnia account | sign-in and security e-mails from `auth.sypnia.com` | Every e-mail the suite sends goes out through Sypnia Mail, and every product sends from its own verified domain. ### What it proves An alert that arrives late, twice, or in spam is the worst thing that can happen to Telemetry. If Mail's limits, retries or reputation fail, Telemetry is the first to feel it, in production, every day. --- ## Sending domains > Verifying your domain: DKIM, SPF and DMARC, done for you when the domain is in Sypnia Domains. Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service). Source: https://mail.docs.sypnia.com/domains/ - [Verify a domain](/domains/verify-a-domain/): Why inboxes need proof, the records that give it, and how verification works. - [DNS records reference](/domains/dns-records/): The exact records Mail asks for, and how to check them. --- ## Verify a domain > Why inboxes need proof, the records that give it, and how verification works. Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service). Source: https://mail.docs.sypnia.com/domains/verify-a-domain/ For agents: Mail domain verification: DKIM (3 CNAMEs ._domainkey), SPF on return path (MX + TXT on bounce.), DMARC (TXT _dmarc) aligned → meets Gmail/Yahoo sender requirements; mail domains add checks every few minutes for 72 h until verified; only verified domains can send; subdomains verifiable separately; with Sypnia Domains records automatic, minutes; DMARC p=none with reports, suggest quarantine after 2 weeks clean. Inboxes trust mail that proves it comes from the domain in the `From`. Three records give that proof: | Record | Proves | Added as | | ---------------------------- | ------------------------------------------------------------------ | ------------------------------------------------------ | | **DKIM** | the message was signed by a key published in your DNS | three `CNAME` records `._domainkey.laespiga.co` | | **SPF** (on the return path) | the sending servers are allowed to send for your domain | an `MX` and a `TXT` on `bounce.laespiga.co` | | **DMARC** | what receivers should do with mail that fails, and where to report | a `TXT` on `_dmarc.laespiga.co` | With all three aligned to your domain, Gmail's and Yahoo's requirements for senders are met. ### Verification `mail domains add` starts it; Mail checks the records every few minutes for 72 hours and the domain becomes `verified`. You can send only from verified domains. A subdomain (`mail.laespiga.co`) can be verified on its own, to keep transactional mail's reputation apart from the rest. ### With Sypnia Domains When the domain is in [Sypnia Domains](https://domains.sypnia.com) in the same organization, the records are written for you and verification finishes in minutes. DMARC starts at `p=none` with reports to Mail; the console suggests `quarantine` after two weeks without failures. --- ## DNS records reference > The exact records Mail asks for, and how to check them. Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service). Source: https://mail.docs.sypnia.com/domains/dns-records/ For agents: Mail DNS records: 3 DKIM CNAMEs ._domainkey → .dkim.amazonses.com, MX bounce. 10 feedback-smtp.us-east-2.amazonses.com, TXT bounce. v=spf1 include:amazonses.com ~all, TXT _dmarc v=DMARC1; p=none; rua=mailto:dmarc@.inbound.mail.sypnia.com; tokens via mail domains records; keep existing DMARC and add rua; mail domains check. For `laespiga.co`: | Type | Name | Value | | ------- | ------------------------------- | ------------------------------------------------------------------ | | `CNAME` | `abc123._domainkey.laespiga.co` | `abc123.dkim.amazonses.com` | | `CNAME` | `def456._domainkey.laespiga.co` | `def456.dkim.amazonses.com` | | `CNAME` | `ghi789._domainkey.laespiga.co` | `ghi789.dkim.amazonses.com` | | `MX` | `bounce.laespiga.co` | `10 feedback-smtp.us-east-2.amazonses.com` | | `TXT` | `bounce.laespiga.co` | `v=spf1 include:amazonses.com ~all` | | `TXT` | `_dmarc.laespiga.co` | `v=DMARC1; p=none; rua=mailto:dmarc@.inbound.mail.sypnia.com` | The DKIM tokens are your domain's own; `mail domains records laespiga.co` prints them. If your domain already has a DMARC record, keep it and add the `rua` address to it rather than adding a second record. ```bash npx @sypnia/mail domains check laespiga.co ``` --- ## Sending > The send API, templates, attachments, scheduling and the SMTP relay. Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service). Source: https://mail.docs.sypnia.com/sending/ - [The send API](/sending/send-api/): One call to send an e-mail, what it checks, and how to send many safely. - [Templates](/sending/templates/): Templates with variables, versions, languages and a preview, kept with your project. - [Attachments and scheduling](/sending/attachments-and-scheduling/): Attach files inline or from Sypnia Files, and send later. - [SMTP relay](/sending/smtp-relay/): Send from any app or tool that speaks SMTP, with the same domains, templates and events. --- ## The send API > One call to send an e-mail, what it checks, and how to send many safely. Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service). Source: https://mail.docs.sypnia.com/sending/send-api/ For agents: Mail send API: mail.send({from, to, cc, bcc, replyTo, subject, html, text | template+data, tags, idempotencyKey}); checks scope send (403), verified from domain (422 domain_not_verified), suppression (skipped, suppressed[]; 422 all_suppressed), ≤50 recipients (400), ≤10 MB (413), rate/daily limit (429 retry-after); 202 {id, suppressed} = queued; idempotencyKey dedupes 24 h; sendBatch up to 100 personal messages; tags up to 10 keys returned on events. ```ts const { id } = await mail.send({ from: 'La Espiga ', to: ['ana@example.com'], replyTo: 'hola@laespiga.co', subject: 'Tu pedido #1042 está listo', html: '

Hola Ana, ya puedes recogerlo.

', text: 'Hola Ana, ya puedes recogerlo.', tags: { kind: 'order-ready', order: '1042' }, idempotencyKey: 'order-ready-1042', }); ``` ### What it checks before answering | Check | If it fails | | ------------------------------------------------- | ------------------------------------------------------------------------------------------ | | the key's scope includes `send` | `403 forbidden` | | the `from` domain is verified in the project | `422 domain_not_verified` | | no recipient is on the suppression list | that recipient is skipped and reported in `suppressed[]`; if all are, `422 all_suppressed` | | at most 50 recipients across `to`, `cc` and `bcc` | `400 too_many_recipients` | | size with attachments at most 10 MB | `413 too_large` | | the project's rate and daily limit | `429 rate_limited` with `retry-after` | The answer is `202 Accepted` with `{ id, suppressed }`. Accepted means queued, not delivered: [Events](https://mail.docs.sypnia.com/events) tell you the rest. ### Idempotency With `idempotencyKey`, sending the same key again within 24 hours returns the first e-mail's id and sends nothing. Use it whenever a retry could repeat a send. ### Many e-mails `mail.sendBatch([...])` takes up to 100 messages in one call, each with its own recipient and data, and returns an id per message. Every message is personal: one recipient, one e-mail. Batches still count against the rate limit. ### Tags `tags` are up to 10 keys of your own; they come back on every event of the e-mail and you can filter the log by them. --- ## Templates > Templates with variables, versions, languages and a preview, kept with your project. Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service). Source: https://mail.docs.sypnia.com/sending/templates/ For agents: Mail templates: name, subject, HTML, optional text (generated from HTML); {{var}} Handlebars-style (#if, #each, escaping); preview with data; versions: sends use published, templates publish/rollback --to N, pin template@3; per-language versions chosen by locale with default fallback; templates pull/push to mail/templates// (subject.txt, body.html, body.txt, meta.json); templates as React components (@sypnia/mail/react, rendered by templates push); Data sign-in e-mails: Data provider sypnia_mail with a from on a verified domain, templates stay in Data, Mail sends, logs with tag kind=auth., suppresses bounces, counted with the organization's mail (10 free a month, then credits). A template has a name, a subject, an HTML body and an optional text body. Variables use `{{name}}`; `{{#if}}`, `{{#each}}` and escaping work as in Handlebars. If you leave out the text body, it is made from the HTML. ```bash npx @sypnia/mail templates create order-ready --subject "Tu pedido {{order}} está listo" --html ./order-ready.html npx @sypnia/mail templates preview order-ready --data '{"name":"Ana","order":"#1042"}' ``` ### Versions Every change makes a new version; sends use the **published** one. `templates publish order-ready` publishes the latest draft, `templates rollback order-ready --to 3` goes back. A send can pin a version with `template: 'order-ready@3'`. ### Languages A template can have a version per language (`es`, `en`, `pt-BR`). The send picks it with `locale`; without a match it uses the template's default language. ### Templates as files `mail templates pull` writes every template to `mail/templates//` (`subject.txt`, `body.html`, `body.txt`, `meta.json`) and `mail templates push` sends them back, so templates can live in your repository and be reviewed like code. ### Templates as React components If you prefer writing e-mails as components, `@sypnia/mail/react` renders them to HTML that mail apps show correctly: `mail/order-ready.tsx` ```tsx import { Email, Section, Button } from '@sypnia/mail/react'; export default function OrderReady({ name, order }: { name: string; order: string }) { return (
Hi {name}, your order {order} is ready to pick up.
); } ``` `npx @sypnia/mail templates push` renders each component in `mail/` and stores the result as a new version of the template with the same name, so sends, versions, languages and previews work exactly as above. ### Sign-in e-mails of Sypnia Data Sypnia Mail is one of the e-mail providers a [Sypnia Data](https://data.docs.sypnia.com/auth/email-providers-and-templates) project can choose for its sign-in e-mails: confirmations, magic links, codes, password recovery, invitations and e-mail changes. Choose `sypnia_mail` in the project's auth settings and give a `from` address on a domain verified here; nothing else is needed. - **The words stay in Data.** Each type of sign-in e-mail keeps its template in Data, with the variables Data documents; Mail sends what Data writes, from your domain. - **Everything else is Mail's.** Each e-mail is in the [event log](https://mail.docs.sypnia.com/events/event-log) with the tag `kind=auth.`, bounces are suppressed, and the domain's limits and reputation apply as for any send. - **Paid like any e-mail.** The sends are counted with the rest of your organization's mail: the first 10 of each month are free, and the rest are paid with your organization's credits. --- ## Attachments and scheduling > Attach files inline or from Sypnia Files, and send later. Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service). Source: https://mail.docs.sypnia.com/sending/attachments-and-scheduling/ For agents: Mail attachments: inline content (base64 in API) or file: files://bucket/path from Sypnia Files (read with project access at send time); total ≤10 MB; executable types refused 415; inline images via inline:true + cid; scheduledAt up to 30 days ahead, mail.cancel(id) while scheduled. ### Attachments ```ts await mail.send({ from: 'facturas@laespiga.co', to: 'ana@example.com', template: 'receipt', data: { order: '#1042' }, attachments: [ { filename: 'recibo-1042.pdf', content: pdfBytes }, // inline, base64 in the API { filename: 'menu.pdf', file: 'files://public/menu/menu-noviembre.pdf' }, // from Sypnia Files ], }); ``` The message with its attachments can be up to 10 MB. Executable types (`.exe`, `.bat`, `.js`, `.scr` and others) are refused with `415 type_not_allowed`. A file from Sypnia Files is read with the project's access when the e-mail is sent. ### Inline images An attachment with `inline: true` and a `cid` can be shown in the HTML as ``. For most images a public link from Sypnia Files is lighter. ### Send later `scheduledAt: '2026-12-24T08:00:00-05:00'` queues the e-mail for that time, up to 30 days ahead. `mail.cancel(id)` cancels it while it is still `scheduled`. --- ## SMTP relay > Send from any app or tool that speaks SMTP, with the same domains, templates and events. Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service). Source: https://mail.docs.sypnia.com/sending/smtp-relay/ For agents: Mail SMTP relay: smtp.mail.sypnia.com (or engine host), 587 STARTTLS or 465 TLS, user sypnia, password = key with smtp scope (mail keys create --scope smtp); same checks as API (verified from, suppression, limits, events); X-Sypnia-Tags header, X-Sypnia-Template + X-Sypnia-Data (JSON); for WordPress, CMS, legacy apps, devices. | Setting | Value | | -------- | ------------------------------------------------------------------------ | | Host | `smtp.mail.sypnia.com` **\[Cloud]**, or your engine's host **\[Engine]** | | Port | `587` with STARTTLS, or `465` with TLS | | User | `sypnia` | | Password | a key with the `smtp` scope: `mail keys create wordpress --scope smtp` | Mail sent through the relay goes through the same checks as the API: verified `from` domain, suppression list, limits and events. The `X-Sypnia-Tags` header (`kind=newsletter-signup; site=blog`) adds tags, and `X-Sypnia-Template` with `X-Sypnia-Data` (JSON) sends a template. The relay is useful for WordPress, a CMS, an old app or a device that can only send by SMTP. For new code, the API gives better errors. --- ## Events > What happened to each e-mail: the log, webhooks, bounces and complaints, and the suppression list. Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service). Source: https://mail.docs.sypnia.com/events/ - [The event log](/events/event-log/): Every state an e-mail goes through, and how to search them. - [Webhooks](/events/webhooks/): Events pushed to your endpoint, signed, retried and in order per e-mail. - [Bounces, complaints and suppression](/events/bounces-and-suppression/): What Mail does when an address bounces or someone marks you as spam. - [Use cases and traces](/events/use-cases/): Each e-mail can say which use case sent it, and what happened to it shows up in that case's trace. --- ## The event log > Every state an e-mail goes through, and how to search them. Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service). Source: https://mail.docs.sypnia.com/events/event-log/ For agents: Mail events: queued, scheduled, sent, delivered, delivery_delayed (SES retries up to 12 h), bounced (hard/soft), complained, opened, clicked, rejected, canceled; mail events filters --to --since --tag --type; open tracking is unreliable (proxies, blocked images) — trend only; open/click tracking off by default; bodies kept for plan retention, events longer without body. | Event | Means | | ------------------ | -------------------------------------------------------------------------------------------------- | | `queued` | accepted and waiting in the project's queue | | `scheduled` | waiting for its `scheduledAt` | | `sent` | handed to Amazon SES | | `delivered` | the recipient's server accepted it | | `delivery_delayed` | the recipient's server asked to retry later; SES keeps trying for up to 12 hours | | `bounced` | it could not be delivered: `hard` (the address does not exist) or `soft` (full mailbox, temporary) | | `complained` | the recipient marked it as spam | | `opened` | the recipient opened it (only with open tracking, and not exact: see below) | | `clicked` | the recipient clicked a link (only with click tracking) | | `rejected` | Mail or SES refused to send it (for example, a virus in an attachment) | | `canceled` | a scheduled e-mail was canceled | ```bash npx @sypnia/mail events --to ana@example.com --since 7d npx @sypnia/mail events --tag kind=order-ready --type bounced ``` ### About opens Open tracking adds a tiny image; many mail apps load images through a proxy or block them, so `opened` can appear without the person reading and be missing when they did. Treat it as a trend, not a fact. Open and click tracking are **off** by default and turned on per project or per send. ### Retention The body of each e-mail is kept for the plan's retention, for support and re-sending; events and metadata are kept longer, without the body. --- ## Webhooks > Events pushed to your endpoint, signed, retried and in order per e-mail. Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service). Source: https://mail.docs.sypnia.com/events/webhooks/ For agents: Mail webhooks: mail webhooks create --events …; POST JSON {id, type, createdAt, email {id,to,from,subject,tags}, bounce {kind, code, message}}; header sypnia-signature t=…,v1=HMAC-SHA256 over t.body, verifyWebhook(request, secret) rejects >5 min; 2xx within 10 s; retries with backoff 24 h then undelivered + webhooks replay; ordered per e-mail; dedupe by id; paused after 3 days failing; Sypnia Run function target run://name. ```bash npx @sypnia/mail webhooks create https://laespiga.co/api/mail-events --events delivered,bounced,complained ``` Each event is a `POST` with a JSON body: ```json { "id": "evt_01JD…", "type": "bounced", "createdAt": "2026-11-17T14:03:22Z", "email": { "id": "em_01JD…", "to": "ana@example.com", "from": "pedidos@laespiga.co", "subject": "Tu pedido #1042 está listo", "tags": { "kind": "order-ready" } }, "bounce": { "kind": "hard", "code": "5.1.1", "message": "The email account that you tried to reach does not exist." } } ``` ### Checking the signature Each request carries `sypnia-signature: t=,v1=` over `.` with the webhook's secret. `verifyWebhook(request, secret)` from `@sypnia/mail/server` checks it and refuses requests older than 5 minutes. ### Delivery - Your endpoint must answer `2xx` within 10 seconds. - Failures are retried with backoff for 24 hours; after that the event stays in the log, marked undelivered, and `mail webhooks replay` sends it again. - Events of one e-mail arrive in order; events of different e-mails can arrive in any order. Use `id` to ignore duplicates. - A webhook that fails for 3 days in a row is paused and you are notified. With **Sypnia Run**, a function in the same project can be the webhook without a public URL: `--target run://mail-events`. --- ## Bounces, complaints and suppression > What Mail does when an address bounces or someone marks you as spam. Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service). Source: https://mail.docs.sypnia.com/events/bounces-and-suppression/ For agents: Mail suppression list per project: hard_bounce (remove manually), complaint (only at person request), soft_bounce_repeated (5 in 7 days; auto-removed after 14 days), manual, unsubscribed; mail suppressions ls/add/rm; automatic and cannot be disabled; one-click List-Unsubscribe and {{unsubscribe_url}} for optional e-mail kinds; account/receipt/reset e-mails exempt. ### The suppression list Each project has a list of addresses Mail will not send to: | Reason | Added when | Removed | | ---------------------- | -------------------------------------- | ---------------------------------------- | | `hard_bounce` | the address does not exist | by you, if you are sure it was fixed | | `complaint` | the person marked an e-mail as spam | only if the person asks to receive again | | `soft_bounce_repeated` | 5 soft bounces in 7 days | automatically after 14 days | | `manual` | you added it (`mail suppressions add`) | by you | | `unsubscribed` | the person used your unsubscribe link | by the person subscribing again | ```bash npx @sypnia/mail suppressions ls --reason complaint npx @sypnia/mail suppressions rm ana@example.com ``` ### Why it matters Sending again to addresses that bounce or complain is what drives a domain into spam folders, and in Sypnia Cloud it puts the shared reputation at risk. That is why suppression is automatic and cannot be turned off; you can only remove an address deliberately, and complaints only at the person's request. ### Unsubscribe E-mails with the tag `kind` you mark as optional (for example reminders) get a one-click `List-Unsubscribe` header and a link you can place with `{{unsubscribe_url}}`. Account e-mails, receipts and password resets do not need it. --- ## Use cases and traces > Each e-mail can say which use case sent it, and what happened to it shows up in that case's trace. Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service). Source: https://mail.docs.sypnia.com/events/use-cases/ For agents: Case attribution in Mail: send option case or header Sypnia-Case (send, sendBatch, SMTP relay header Sypnia-Case); inside a request traced by @sypnia/telemetry the SDK reads the active case and sends traceparent, so case can be omitted. Stored on the e-mail (case, trace id); events carry case; mail events --case . A case file declares its e-mails: mail: { sends: [order-ready] } (template names); the Cases check reports a case that sends a template it does not list, or lists one it never sends. Spans: mail.send