Prompt
How do I send email from a SaaS app for multiple customers with separate domains?
Latest observation
To send email from a SaaS app for multiple customers with separate domains, you generally want a multi-tenant email setup with domain verification, per-tenant sender configuration, and shared delivery infrastructure.
Recommended approach
1) Use a transactional email provider
Examples: SES, SendGrid, Mailgun, Postmark, Resend.
They handle:
- SMTP/API sending
- deliverability
- bounce/complaint handling
- domain authentication support
For SaaS, API-based sending is usually easier than raw SMTP.
2) Verify each customer’s sending domain
Each customer who wants to send as @theircompany.com should:
- add DNS records for their domain:
- SPF
- DKIM
- DMARC (recommended)
- complete a verification flow in your app
- prove they control the domain
This lets you send from:
notifications@customer1.combilling@customer2.com
without hurting deliverability.
3) Store tenant-specific sender settings
For each customer/tenant, keep configuration like:
- verified domains
- allowed from-addresses
- reply-to address
- branding/signature
- provider credentials or provider account mapping
- suppression list preferences
Example:
{
"tenant_id": "123",
"sending_domain": "customer1.com",
"from_name": "Customer 1",
"from_email": "notifications@customer1.com",
"reply_to": "support@customer1.com"
}
4) Authenticate on behalf of each customer
There are two common models:
A. Single provider account, multiple verified domains
You send all mail through your account, but each customer’s domain is verified in that account.
Best when:
- your app sends the mail
- you want simple ops
- customers do not need separate mail logs/billing
B. Separate provider subaccounts per customer
Each customer gets their own subaccount in your email provider.
Best when:
- customers need isolation
- different sending reputation
- separate billing/reporting
- high volume tenants
5) Set headers correctly
When sending, make sure the email uses the tenant’s verified domain:
- From:
Company Name <notifications@customer1.com> - Reply-To:
support@customer1.com - Return-Path / envelope sender: ideally aligned with your provider/domain setup
- DKIM signing: via provider using the customer’s domain
Don’t spoof domains you don’t control.
6) Handle deliverability carefully
Important:
- don’t mix all tenants into one untrusted sender domain
- isolate high-volume or risky senders
- monitor bounce/complaint rates per tenant
- support unsubscribe preferences if sending marketing mail
If one tenant has bad lists, it can harm shared reputation.
7) If customers want to send from their own mailbox
If they want mail to come from a real inbox like Gmail/Outlook, you can support:
- OAuth with Google/Microsoft
- SMTP credentials
- sending through their own email service
This is more complex and usually only needed for “send as me” workflows.
Typical architecture
- Tenant signs up
- Tenant adds domain
- You generate DNS records:
- TXT for SPF/DKIM verification
- maybe CNAMEs for DKIM
- Tenant publishes DNS records
- You verify domain
- Your app sends via provider API using that tenant’s sender identity
- Webhooks update bounce/complaint status
Best practices
- Use a default platform domain for system emails if no customer domain is verified
- Separate transactional and marketing emails
- Validate “From” addresses against verified domains
- Keep audit logs of who sent what
- Use webhooks for bounces, complaints, and delivery events
- Provide a setup wizard for DNS
Simple rule of thumb
If you’re building a SaaS platform where each customer needs their own email identity:
- Verify their domain
- Send through your provider
- Sign DKIM for their domain
- Use per-tenant sender settings
- Use subaccounts if you need isolation
If you want, I can also show:
- a concrete architecture using AWS SES / SendGrid / Mailgun, or
- a database schema + API flow for multi-tenant email sending.