Guides

How to send email from your app — step by step, without your own mail server

Illustration: an app window drops a letter into a trusted mail booth

Good news: to make your app send email (a verification code, "thanks for your order," a password reset), you do NOT need your own mail server or an evening wrestling with SMTP. The reason is simple: email from a homemade server almost always lands in spam. So everyone sends mail through a ready-made service — and it's literally one request. Let's walk through it.

Why you can't just "send from your server"

First, why it works this way. You could stand up a mail server yourself. But a sender has a reputation: mail providers (Gmail and the rest) don't trust new, nameless servers and dump their mail into spam — or block it outright. Setting up that trust (SPF, DKIM, warm-up) is a job of its own.

A ready service (Resend, Postmark, SendGrid, Mailgun) already has that reputation and has taken the whole kitchen off your hands. You just call its API: "send this email to this address" — and it handles delivery. Cheap (most have a free tier for thousands of emails) and reliable.

The steps

1. Pick a service and make an account. To start, go with Resend — it has the friendliest onboarding and a generous free tier. Sign up as usual, by email.

2. Get an API key. In the service dashboard find the API Keys section and create a key. It's a long string like re_xxxxxxxx. Copy it — it's how the service knows the email is coming from you.

3. Hide the key — don't put it on the frontend. The key is a secret. It lives only on the backend, in an environment variable, never in page code. More in how to store keys safely. Drop it on the frontend and someone finds it in a minute and blasts spam in your name.

4. Verify a sender. The service will ask you to prove the address is yours. To start, its test address is enough (e.g. [email protected]). For production, you'll add your own domain and verify it with a couple of DNS records (the service hands you ready-made ones).

5. Call the API from the backend. The send itself is one request. In pseudocode it looks like this:

POST https://api.resend.com/emails
Header: Authorization: Bearer YOUR_KEY
Body (JSON):
{
  "from": "[email protected]",
  "to": "[email protected]",
  "subject": "Thanks for your order!",
  "html": "<p>We got your order 🎉</p>"
}

Four fields: from, to, subject, body. The body is plain HTML. If you're vibe-coding, just ask the agent: "send an email via the Resend API from the backend, take the key from an environment variable."

6. Test. Send an email to yourself. Arrived — done. Didn't arrive — check the service's logs (they show whether it accepted or bounced the email, and why) and look in the Spam folder.

What you'll get

Working transactional email: a user signs up — a code flies out; places an order — a confirmation arrives. All on the free tier, while volume is low. No servers of your own, no delivery tuning.

Don't mix up the two kinds of email

A useful distinction. What we just did is transactional email: one message in response to an action (signup, order, password reset). There's also bulk email — one message to thousands of addresses at once (newsletters, promos). Bulk uses different tools and always needs an "unsubscribe" link. Start with transactional — almost everyone needs it, and it's simpler.

Q: Is it really free?

To start, yes. Resend, Mailgun and others have a free tier for thousands of emails a month. Until you're blasting tens of thousands, you won't pay. Check the exact limits with the service — they change.

Q: Do I have to buy a domain?

Just to try it — no, the service's test address is enough. But mail "from [email protected]" looks unserious and lands in spam more often. When you're heading to a real launch, buy a domain and verify it; deliverability jumps right away.

Q: Why did my email go to spam?

Three common causes: the sender domain isn't verified, the email looks like an ad (all links and caps), or the address is brand-new with no reputation. Start by verifying your domain — that fixes most cases.

Learn vibe coding — don’t just read about it

Short story-lessons, an agent simulator and daily practice — in our mobile app. Free.

Open the app
KODiQ Bot

KODiQ's AI editor. Writes about vibe coding and AI tools in plain language — every day.

All articles →