DEV Community

Ciro Cesar Maciel
Ciro Cesar Maciel

Posted on Originally published at blog.myinfrastructure.click

Sending confirmation and password e-mails from your app without running a mail server

The app has to send e-mail: confirm a sign-up, send a code, send the receipt, warn that the subscription expired. The agent that wrote the app tends to suggest an SMTP server, a Gmail app password or a library talking to some provider. The Gmail shortcut causes the most trouble: low limits, mail leaving from your personal address, messages landing in spam. The serverless path is a transactional e-mail API that sends from your domain with one HTTP call.

This is how it works with Messages, from the Infrastructure line (by Ciro Cesar Maciel, who writes this).

First: you may not need the password e-mail at all

Half of the e-mails an app sends exist because of the password: confirm sign-up, forgot password, password changed. If sign-in is by an e-mail code, as with Infrastructure Auth, none of them exist. The person types the e-mail, gets an 8-character code and is in, and Auth sends that code itself. What remains for your app are the business e-mails: the receipt, "your report is ready", an invitation. That is what Messages is for.

What it takes

1. A project and its key. The project's secret key starts with msk_, lives only on the server and is shown once, at creation; there is no way to recover it. No account yet? The agent building the app creates it from https://myinfrastructure.click/products/messages/llms.txt; your only step is reading the e-mail code.

2. Verify the domain, the one step that depends on you. You add your domain and get the DNS records: three DKIM CNAMEs that sign each message, an SPF TXT and a return MX, both on send.yourdomain.com, and a recommended DMARC TXT. The detail that protects the e-mail you already use: SPF and MX go on send.<domain>, not the root, so your Google Workspace or other provider keeps working. Propagation takes minutes to a few hours, and nothing with that sender goes out until the domain is verified.

3. The send call.

POST https://messages.worker.myinfrastructure.click/emails
Authorization: Bearer msk_…

{
  "from": "hi@yourdomain.com",
  "to": "customer@example.com",
  "subject": "Your receipt",
  "html": "<p>Thanks for your order.</p>",
  "text": "Thanks for your order.",
  "idempotencyKey": "receipt/order-123"
}
Enter fullscreen mode Exit fullscreen mode

The idempotency key prevents duplicate e-mails when the app retries after a network error. Derive it from the fact (the order id), never from the clock.

After the send

Each send builds a timeline of events: sent, delivered, opened, clicked, bounced, complained. The dashboard shows it, and a webhook can notify your system. A permanent bounce or a complaint puts the address on the project's suppression list by itself, as long as the return MX is in place; without it, bounces never come back and you keep mailing dead addresses.

What usually goes wrong

  • The send is refused. Almost always the from domain is not verified in that project.
  • Verification never completes. One extra character in a DKIM CNAME value.
  • The company's SPF broke. Someone put the record on the root instead of send.<domain>.

Honest notes

  • E-mail only: no SMS or WhatsApp. No contact lists, segments or automations; bulk sending exists but takes one finished message per recipient.
  • No SMTP for a mail client, no scheduling: each send goes out now. The IP pool is shared; dedicated IPs do not exist.
  • Works from any backend: there is no SDK to install, just an HTTP route.
  • Without a plan: 1 domain and 2,000 sends a month, counted per recipient, capped at 130 per 24 hours.
  • An MCP server lets an agent read sends, events, suppressions and inboxes with your browser sign-in.
  • The Messages dashboard is in Portuguese for now.

Top comments (0)