Skip to content
AI-powered appsNewChat, vision, voice, generationBookings & schedulingAppointments that book themselvesShops & sellingA storefront in every pocketClient & businessRun the operation from one placeCommunities & clubsA home that is not a group chat
Health & wellnessHabits, tracking and calmGames2D, 3D and multiplayerPersonal & toolsThe tool you wish existedInternal toolsThe tool ops never had time for
See all use cases
ArcadeNewPricingSecurity
EngineThe game engine and World EditorHow it worksFrom one sentence to a live productDocsGuides for building and publishingBlogStories, guides and newsChangelogWhat shipped latelyStatusUptime of every serviceSupportGet help from the team
AI-powered appsBookings & schedulingShops & sellingClient & businessCommunities & clubsHealth & wellnessGamesPersonal & toolsInternal tools
See all use cases
ArcadeNewPricingSecurity
EngineHow it worksDocsBlogChangelogStatusSupport
Language
Blog
BackendNovember 22, 20265 min read

How to Send Emails from Your App

Apps do not send email from your inbox. They hand it to an email service with a verified domain. Here is the setup, the DNS records and the habits that keep you out of spam.

Startbase Team
Editorial ink illustration of a wax-sealed envelope sliding through a brass mail slot in a front door, the wax seal in ember orange

Key takeaways

  • Apps send email through an email service using an API key from server code, never from the browser and never from a personal inbox.
  • A verified sending domain with SPF, DKIM and DMARC records is what gets mail into inboxes instead of spam.
  • Keep transactional mail (receipts, resets) separate from marketing mail, and give marketing mail a working unsubscribe link.

To send emails from your app, you use an email sending service (such as Resend, Postmark, Amazon SES or SendGrid). Your backend calls the service's API with a secret key, the recipient, a subject and the body, and the service delivers the message. To reach inboxes reliably, you verify a domain you own by adding a few DNS records, so receiving mail servers can tell the message really came from you. The sending code is short; the domain setup is where most of the work and most of the problems are.

Two kinds of email, two sets of rules

  • Transactional email is triggered by something the user did or needs: a sign-up confirmation, a magic link, a password reset, a receipt, "your booking is tomorrow at 10:00". People expect it and act on it, often within seconds.
  • Marketing email goes to many people at once for your reasons: newsletters, product announcements, "we miss you". It needs consent where the law requires it and a clear way to unsubscribe.

Keep them apart. Many teams send marketing mail from a different subdomain (for example `news.yourapp.com`) than transactional mail, so a newsletter that annoys people never drags down the delivery of password resets.

Why you cannot just use your Gmail

Personal mailboxes have daily sending limits, are not built for automated mail, and would need your password stored in the app. More importantly, mail from an app has to prove it is legitimate. Email services handle the reputation, retries, bounces and complaints at scale, and give you logs showing whether each message was delivered.

SPF, DKIM and DMARC without the jargon

Anyone can write any "From" address on an email, the way anyone can write any return address on an envelope. Receiving servers (Gmail, Outlook, Yahoo) check three DNS records on your domain to decide whether to believe you:

  1. 01SPF is a list of servers allowed to send mail for your domain. "Mail from yourapp.com may come from this email service."
  2. 02DKIM is a signature. The email service signs each message with a private key, and your DNS publishes the matching public key, so the receiver can check the message was not forged or altered.
  3. 03DMARC tells receivers what to do when SPF or DKIM fail (nothing, spam folder, or reject) and where to send reports.

Your email service shows you the exact records to copy into your domain's DNS settings. Gmail and Yahoo now require bulk senders to have authentication, a DMARC policy and one-click unsubscribe on marketing mail, so these records are no longer optional extras.

Tip

Send from a subdomain such as `mail.yourapp.com`. It keeps your app's email reputation separate from the domain you use for your own inbox.

What sending looks like in practice

Take a booking app. When a booking is confirmed, a server function runs these steps:

  1. 01Load the booking, the customer's email and their time zone from the database.
  2. 02Fill a template: "Hi Maya, you are booked for a haircut with Jonas on Friday 4 December at 10:00. Reschedule: <link>."
  3. 03Call the email service with the key from the server's secrets, `from: bookings@mail.yourapp.com`, the subject and both an HTML and a plain-text version.
  4. 04Save a row in an `email_log` table: booking ID, recipient, template, the service's message ID, status.
  5. 05If the call fails, retry once, then record the failure so someone can look.

The log matters more than it looks. When a customer says "I never got the email", it is the difference between a guess and an answer.

Why app email lands in spam

  • Missing or broken DNS records. The most common cause by far. Check that SPF, DKIM and DMARC show as verified.
  • A brand-new domain sending a lot at once. Reputation builds over time. Start with transactional mail and grow volume gradually.
  • Sending to people who did not ask. Bought lists and pre-ticked boxes produce spam complaints, and complaints hurt every message you send afterward.
  • No plain-text version, image-only messages, or link shorteners. All look like spam to filters.
  • Ignoring bounces. Keep sending to dead addresses and receivers stop trusting you. Email services usually suppress hard bounces automatically.

Writing emails people act on

Getting delivered is half the job. The other half is an email people understand in three seconds on a phone:

  • A sender name they recognize: "Studio Bloom", not "noreply". Set a reply-to address that a person reads, because customers reply to receipts with questions.
  • A subject that says what happened: "Your booking for Friday at 10:00 is confirmed" beats "Booking update".
  • One main action: a single clear button (Reset password, View ticket, Reschedule). Secondary links go below it.
  • Times in the reader's time zone, with the day of the week. Ambiguous times are the top cause of missed appointments.
  • Test in dark mode and on a phone. Logos on transparent backgrounds and light gray text often disappear.

Keep templates short. A transactional email that needs scrolling usually means part of it belongs in the app instead.

Email in a Startbase app

Startbase Cloud has an Emails section with three tabs: Domain, Auth emails and App emails. With zero setup, your app can send through the platform sender using `sendEmail` from its helper library, within a daily limit per project shown as "N of M emails sent today". Platform email runs through the App AI gateway, so turn that on in the AI section first. When you want branded senders and higher volume, add a free Resend API key and connect your own domain: Startbase shows the DNS records to add with copy buttons and checks verification automatically every few seconds. Until your domain verifies, Resend only delivers to your own address.

Once verified, "Use this domain for auth emails" makes sign-up confirmations, magic links and password resets come from your brand, and five templates (confirm sign-up, magic link, reset password, invite user, change email) are editable. Keep placeholders like `{{ .ConfirmationURL }}` intact or the email's button stops working. For app email such as welcome messages and digests, the agent sends through one server function using your `RESEND_API_KEY` secret and logs each send in an `email_send_log` table. See the Emails docs.

Send transactional emails for my class booking app from bookings@mail.mystudio.com. On booking: a confirmation with the class, teacher, date and time in the student's time zone and a cancel link. 24 hours before class: a reminder. On cancellation: a short confirmation. Plain, friendly wording, an HTML and a text version, and log every send with its status.

That 24-hour reminder is a scheduled job, not something a user clicks; scheduled jobs explained shows how those work. And because email services need a secret key, read API keys and secrets before you paste one anywhere.

Frequently asked questions

What is the best way to send emails from a web app?

Use a transactional email service called from server code, with a verified sending domain. Never send from the browser, which would expose your key, and do not use a personal mailbox.

Why are my app emails going to spam?

Most often the domain's SPF, DKIM or DMARC records are missing or wrong. Other causes are a new domain sending too much too fast, spam complaints, and image-only messages without a text version.

Do I need an unsubscribe link?

For marketing and newsletter email, yes: laws in many countries and the major mailbox providers expect a clear, working unsubscribe. Transactional mail like receipts and password resets does not need one.

Can my app send email without a custom domain?

On Startbase, yes: the platform sender works with zero setup within a daily limit, once the App AI gateway is on. Connect your own domain for branded senders and higher volume.

On this page

  • Two kinds of email, two sets of rules
  • Why you cannot just use your Gmail
  • SPF, DKIM and DMARC without the jargon
  • What sending looks like in practice
  • Why app email lands in spam
  • Writing emails people act on
  • Email in a Startbase app

Keep reading

More in Backend
Editorial ink illustration of a shop counter with a brass cash register and a curling paper receipt, the receipt in ember orange
BackendNovember 22, 2026

How to Accept Payments in Your App with Stripe

Taking money online is mostly a solved problem, if you let Stripe hold the card and you trust only its webhook. Here is the flow, the data you store and the mistakes to avoid.

5 min read
Editorial ink illustration of an iron safe set into a workshop wall with a key hanging on a hook beside it, the key in ember orange
BackendNovember 22, 2026

API Keys and Secrets: Keeping Them Safe

Anything you ship to a browser or phone can be read. Here is how to tell a public key from a secret one, where secrets belong, and the five-step plan for a leaked key.

5 min read

Read less. Ship more.

Everything in this post is one prompt away. Describe your app and watch it build.

Start building

Apps, games, backends and publishing from one conversation.

Product

  • Features
  • Use cases
  • Pricing
  • Changelog

Resources

  • Blog
  • Docs
  • Support
  • Status
  • Security

Contact

  • w@startbase.ai
  • X / Twitter
  • LinkedIn
  • Instagram

Legal

  • Terms
  • Privacy

© 2026 Startbase. All rights reserved.