How to Add Email Inboxes to Your SaaS Product (Without Managing a Mail Server)
Add real email inboxes to your SaaS product using an API. No Postfix, no Dovecot, no mail server ops. Complete architecture guide with code examples, cost analysis, and scaling strategy.

Your SaaS product needs to give each user their own email inbox. Maybe it is a helpdesk platform where each support team gets a shared email address. Maybe it is a project management tool where tasks can be created by emailing a project-specific address. Maybe it is a CRM where every deal has a unique inbox for communication tracking.
Whatever the use case, the requirement is the same: real email inboxes, created programmatically, accessible via standard protocols, integrated into your product. And the question every engineering team asks is: do we really need to run a mail server for this?
The answer, for nearly every SaaS product, is no. Running a mail server is one of the highest-maintenance infrastructure decisions a team can make, and it diverts engineering resources from your core product. This guide walks through the API-first alternative: how to provision real inboxes for your users without managing any email infrastructure.
What "Managing a Mail Server" Actually Means
When founders hear "just set up a mail server," they often underestimate the scope. Here is what you would actually be committing to, based on real-world experience from teams that have done it.
Initial setup (2-4 weeks of engineering time): Install and configure Postfix (mail transfer agent), Dovecot (IMAP/POP3 server), SpamAssassin or Rspamd (spam filtering). Configure virtual users and mailbox mappings for multi-tenant use. Set up SSL/TLS certificates across all services with automated renewal. Configure SPF, DKIM, and DMARC DNS records. Test with multiple email clients. Set up monitoring and alerting. Configure log aggregation. Build provisioning scripts for new mailboxes.
Ongoing operations (5-15 hours per month): Monitor mail queues and bounce rates. Apply security patches to all components — Postfix, Dovecot, OpenSSL, the OS itself. Manage storage as mailboxes grow unpredictably. Tune spam filters as patterns change and false positives frustrate users. Handle IP reputation issues when a user or bot sends something flagged. Troubleshoot delivery failures that affect specific recipients or domains. Respond to incidents when mail stops flowing at 3 AM.
Scaling challenges: As your user base grows, your mail infrastructure needs to grow with it. More storage, more concurrent IMAP connections, more CPU for spam filtering. At some point, you need redundancy — a single mail server is a single point of failure that takes down email for every user when it goes offline.
According to the Dovecot documentation, even configuring basic multi-tenant IMAP serving requires understanding authentication backends, mail storage formats, namespace configuration, and quota management. This is a full engineering workstream.
For most SaaS products, email inboxes are a feature, not the product. Spending months building and maintaining mail infrastructure for a feature is a misallocation of engineering resources that directly competes with shipping product improvements your customers are actually asking for.
The API-First Approach
Instead of running mail servers, you use an email inbox provider's API to create and manage inboxes programmatically. Each inbox is a real email account with IMAP and SMTP access — not a simulated or forwarded address. Standard protocols mean your integration works with any email library, and your users can connect any email client.
With Reusable.Email, each managed inbox costs $3 as a one-time payment. The inbox is permanent (365-day retention), supports IMAP (imap.reusable.email:993, SSL/TLS), SMTP (smtp.reusable.email:587, STARTTLS), and POP3, and includes spam filtering.
For higher-volume use cases, the whitelabel tier at $30/month provides unlimited managed inboxes under your own domain with full API access, webhooks, and an admin panel.
The key insight is that the API creates real inboxes, not simulations. Your users get the same IMAP/SMTP access they would have with any hosted email service. The difference is that you provision and manage these inboxes programmatically through your application's backend, rather than through a manual admin interface.
Architecture Walkthrough
Here is how the integration works in practice, from user signup through email operations and eventual cleanup.
User Signs Up
When a new user creates an account in your SaaS product, your backend makes an API call to create a managed inbox.
import requests
import os
API_BASE = "https://api.reusable.email/v1"
API_KEY = os.environ["REUSABLE_API_KEY"]
def provision_user_inbox(user_id, org_name):
"""Create a managed inbox when a new user or team signs up."""
response = requests.post(
f"{API_BASE}/inboxes",
headers={"Authorization": f"Bearer {API_KEY}"},
json={
"address": f"team-{user_id}@yourdomain.com",
"display_name": f"Support - {org_name}",
},
)
response.raise_for_status()
return response.json()
# Returns: address, imap credentials, smtp credentials
The API returns credentials: the inbox address, password, and IMAP/SMTP connection settings. These credentials work immediately — there is no provisioning delay.
Store Credentials
Your backend stores the inbox credentials in your database, associated with the user's account. Encrypt passwords at rest using your application's encryption layer:
from cryptography.fernet import Fernet
cipher = Fernet(os.environ["DB_ENCRYPTION_KEY"])
def save_inbox_credentials(db, user_id, inbox_data):
"""Store encrypted inbox credentials in the database."""
db.execute(
"""
INSERT INTO user_inboxes
(user_id, address, imap_host, imap_port, smtp_host, smtp_port,
username, encrypted_password, created_at)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, NOW())
""",
(
user_id,
inbox_data["address"],
"imap.reusable.email", 993,
"smtp.reusable.email", 587,
inbox_data["username"],
cipher.encrypt(inbox_data["password"].encode()).decode(),
),
)
User Accesses Their Inbox
Two options here, depending on your product's UX requirements:
Option A: In-app email. Your frontend fetches email via your backend, which connects to the inbox via IMAP or receives messages via webhooks. Users read and send email within your product's interface. This is the tighter integration and the approach most SaaS products choose.
import imaplib
import email
from email.header import decode_header
def get_user_emails(user_id, limit=20):
"""Fetch recent emails for display in the product UI."""
creds = get_inbox_credentials(user_id)
imap = imaplib.IMAP4_SSL("imap.reusable.email", 993)
imap.login(creds["username"], creds["password"])
imap.select("INBOX")
status, messages = imap.search(None, "ALL")
msg_ids = messages[0].split()[-limit:] # Get most recent
emails = []
for msg_id in reversed(msg_ids):
status, msg_data = imap.fetch(msg_id, "(RFC822)")
msg = email.message_from_bytes(msg_data[0][1])
subject = decode_header(msg["Subject"])[0][0]
if isinstance(subject, bytes):
subject = subject.decode()
emails.append({
"id": msg_id.decode(),
"from": msg["From"],
"subject": subject,
"date": msg["Date"],
"preview": get_text_preview(msg, 200),
})
imap.logout()
return emails
Option B: External email client. You provide the user with IMAP/SMTP credentials. They connect Thunderbird, Apple Mail, Outlook, or any standard client. Your product acts as the provisioning layer.
Most SaaS products choose Option A for tighter integration, but Option B is simpler to implement and may be sufficient depending on your use case. Some products offer both — in-app email as the default experience with the option to connect an external client for power users.
Webhooks for Real-Time Events
If your product needs to react when email arrives — creating a task from an inbound message, triggering a notification, updating a ticket — webhooks are the mechanism. For a detailed implementation guide covering webhooks, IMAP IDLE, and polling strategies, see How to Receive Emails via API.
Configure a webhook endpoint. When email arrives at any inbox on your domain, Reusable.Email sends a POST request to your endpoint with the sender, subject, timestamp, and message content.
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route("/webhook/inbound-email", methods=["POST"])
def handle_inbound_email():
data = request.json
recipient = data["to"]
# Look up which user or team owns this inbox
inbox = db.query(
"SELECT user_id, inbox_type FROM user_inboxes WHERE address = ?",
(recipient,),
)
if not inbox:
return jsonify({"status": "unknown_recipient"}), 200
if inbox.inbox_type == "support":
# Create a support ticket from the email
ticket = create_ticket(
team_id=inbox.user_id,
from_email=data["from"],
subject=data["subject"],
body=data.get("text", ""),
html=data.get("html", ""),
attachments=data.get("attachments", []),
)
notify_team(inbox.user_id, f"New ticket: {ticket.id}")
elif inbox.inbox_type == "project":
# Add as a comment or task in the project
add_project_item(
project_id=inbox.user_id,
from_email=data["from"],
content=data.get("text", ""),
)
return jsonify({"status": "processed"}), 200
This eliminates the need to poll IMAP for new messages, which is both less efficient and adds latency.
Sending Email on Behalf of Users
When users need to reply to emails or send new messages from your product, use SMTP with their inbox credentials:
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
def send_email_as_user(user_id, to_address, subject, body, html_body=None):
"""Send an email from a user's managed inbox."""
creds = get_inbox_credentials(user_id)
msg = MIMEMultipart("alternative")
msg["Subject"] = subject
msg["From"] = creds["address"]
msg["To"] = to_address
msg.attach(MIMEText(body, "plain"))
if html_body:
msg.attach(MIMEText(html_body, "html"))
with smtplib.SMTP("smtp.reusable.email", 587) as server:
server.starttls()
server.login(creds["username"], creds["password"])
server.send_message(msg)
The recipient sees the email coming from your domain — [email protected] — with proper SPF and DKIM authentication handled by the provider.
User Deletes Their Account
When a user leaves your product, clean up their inbox via the API:
def deprovision_user_inbox(user_id):
"""Clean up a user's inbox when they leave the product."""
creds = get_inbox_credentials(user_id)
# Option 1: Delete via API (whitelabel tier)
response = requests.delete(
f"{API_BASE}/inboxes/{creds['inbox_id']}",
headers={"Authorization": f"Bearer {API_KEY}"},
)
# Option 2: Clear messages via IMAP
imap = imaplib.IMAP4_SSL("imap.reusable.email", 993)
imap.login(creds["username"], creds["password"])
imap.select("INBOX")
status, messages = imap.search(None, "ALL")
for msg_id in messages[0].split():
imap.store(msg_id, "+FLAGS", "\\Deleted")
imap.expunge()
imap.logout()
# Remove credentials from your database
db.execute("DELETE FROM user_inboxes WHERE user_id = ?", (user_id,))
Clean account lifecycle management without orphaned mailboxes consuming resources. This is particularly important for GDPR compliance, which requires data deletion upon user request.
Scaling Considerations
Cost at Scale
The economics of inbox provisioning determine whether this architecture is viable for your business model. Here is how the numbers work:
Per-inbox pricing ($3/inbox one-time):
| Users | One-Time Cost | Monthly Cost | Annual Cost |
|---|---|---|---|
| 10 | $30 | $0 | $30 |
| 100 | $300 | $0 | $300 |
| 500 | $1,500 | $0 | $1,500 |
| 1,000 | $3,000 | $0 | $3,000 |
Whitelabel pricing ($30/month, unlimited inboxes):
| Users | One-Time Cost | Monthly Cost | Annual Cost |
|---|---|---|---|
| Any | $0 | $30 | $360 |
The break-even point between managed inboxes and the whitelabel tier is approximately 10 inboxes ($30 one-time vs $30/month). If your product will have more than 10 users with inboxes, the whitelabel tier is more economical within the first year.
Comparison with Alternatives
| Approach | 100 Users/Year | 1,000 Users/Year | Ops Burden |
|---|---|---|---|
| Self-hosted mail server | $6,000-12,000+ | $12,000-24,000+ | Heavy |
| Google Workspace | $8,400 | $84,000 | Light |
| Per-seat email API ($1/user/mo) | $1,200 | $12,000 | None |
| Reusable.Email Managed | $300 (once) | $3,000 (once) | None |
| Reusable.Email Whitelabel | $360 | $360 | None |
At 1,000 users, the whitelabel tier's $360/year is 97% cheaper than Google Workspace and 99% cheaper than self-hosting when you include engineering time. The flat pricing model means your email infrastructure cost does not increase as you grow.
Performance
IMAP connections and API calls scale independently of your application infrastructure. The email provider handles the mail server capacity — connection management, storage allocation, spam filtering compute. Your application only needs to handle the API integration layer.
For IMAP-based architectures, consider connection pooling if you are serving many concurrent users. Each IMAP connection is a persistent TCP socket. A simple pool manager prevents connection storms:
from queue import Queue
import imaplib
class ImapPool:
def __init__(self, host, port, user, password, size=10):
self.pool = Queue(maxsize=size)
for _ in range(size):
conn = imaplib.IMAP4_SSL(host, port)
conn.login(user, password)
self.pool.put(conn)
def get(self):
return self.pool.get(timeout=5)
def release(self, conn):
self.pool.put(conn)
Multi-Tenancy
If your SaaS serves multiple organizations, you might want each organization's inboxes on a separate domain. The whitelabel tier supports multiple custom domains, so [email protected] and [email protected] can coexist under a single account. This is essential for enterprise customers who require their own domain for brand consistency and email authentication.
For custom domain setup including DNS configuration, see the custom domain email guide.
What You Do Not Have to Build
By using an API-first approach to email inboxes, you skip a significant amount of infrastructure work:
- Postfix configuration — no MTA to install, configure, or maintain
- Dovecot setup — no IMAP server to manage or tune
- Spam filtering — handled by the provider, updated continuously
- DNS record management — SPF, DKIM, DMARC auto-configured
- IP reputation — not your problem, managed by the provider's deliverability team
- Storage management — email storage and cleanup handled automatically
- Security patches — applied by the provider without your intervention
- Monitoring — mail server health is not your oncall responsibility
- Backup and disaster recovery — provider handles redundancy
Your engineering team stays focused on your product's core features. The email infrastructure is a dependency you consume, not a system you operate. According to common industry estimates, a full-featured self-hosted email system requires 1,500-3,000 hours of initial engineering time and 200-400 hours of annual maintenance. That is a full-time engineer for over a year.
Real-World Product Patterns
To make this concrete, here are specific SaaS categories where API-provisioned inboxes solve real product problems. Each pattern has been implemented by real companies using this architecture.
Helpdesk / Support Platforms. Each support team or department gets a unique email address ([email protected], [email protected]). Incoming emails become tickets. Agents reply from the shared inbox. Webhooks route emails to the right team based on the receiving address. The email thread is tracked in the helpdesk UI, giving agents full context without switching to an email client.
Project Management Tools. Each project gets an inbox. Team members forward relevant emails to the project address. The emails appear as items in the project timeline. Attachments get stored in the project's file library. This pattern turns email into a first-class input channel for project updates.
CRM Systems. Each deal or contact gets a unique email address for communication tracking. All email between your sales team and the contact routes through the CRM, creating a full communication history without manual logging. The sales rep sends from the CRM; the recipient sees a professional email from the company domain.
Recruitment Platforms. Each job listing gets an address for receiving applications. Candidates email their resume and cover letter. The platform parses the incoming email and creates a structured applicant record. Attachments (resumes, portfolios) are automatically filed with the candidate's profile.
Marketplace Communication. Buyers and sellers communicate through platform-assigned addresses, keeping personal email addresses private and enabling the platform to monitor conversations for fraud or policy violations. This is how Airbnb and Craigslist handle inter-user communication.
Legal and Compliance Platforms. Each matter or case gets a dedicated inbox. All related communication is captured and archived, creating an auditable record. The platform can enforce retention policies and search across communication history.
In each case, the email inbox is a feature that enhances the core product. It would be unreasonable to build and maintain mail server infrastructure just for this feature when a $30/month API subscription handles it.
Security and Compliance
When your product manages email on behalf of users, security is not optional. Here are the practices that matter most:
Encrypt credentials at rest. Use envelope encryption with a dedicated key management service (AWS KMS, Google Cloud KMS, or HashiCorp Vault). Never store plaintext email passwords in your database.
Minimize credential exposure. Your backend should connect to IMAP/SMTP on behalf of users. Never expose inbox passwords to the frontend or include them in API responses to the client.
Use TLS exclusively. IMAP on port 993 uses SSL/TLS. SMTP on port 587 uses STARTTLS. Both encrypt all data in transit. Never connect on unencrypted ports, even in development.
Implement access controls. Users should only be able to access their own inbox. Your API layer should enforce this — never trust client-provided inbox IDs without verifying ownership.
Audit logging. Log all email access operations (read, send, delete) with timestamps and user IDs. This supports both security monitoring and compliance requirements.
Data retention policies. Managed inboxes retain email for 365 days. For industries with specific retention requirements, pull messages into your own compliant storage via IMAP and maintain your own retention schedule.
When This Approach Makes Sense
This pattern fits when:
- Email inboxes are a feature of your product, not the product itself
- You need real inboxes (IMAP/SMTP), not just email forwarding
- You want programmatic inbox creation via API
- You do not have email infrastructure expertise on your team
- You would rather spend engineering time on product features than mail server ops
- You need to scale inbox count without proportional infrastructure investment
- Your users expect standard protocol access (ability to use their preferred email client)
If email IS your core product — you are building an email client, a temp mail service, or an email hosting company — the whitelabel tier is still relevant, but your integration will be deeper and more central to your architecture.
Getting Started
- Decide on inbox strategy: One inbox per user? Per team? Per project? This determines your provisioning logic and influences pricing tier selection.
- Choose pricing tier: Individual managed inboxes ($3 each) for small scale or prototyping, whitelabel ($30/month) for unlimited inboxes at scale. For the detailed pricing breakdown, see the email API for developers guide.
- Integrate the API: Inbox creation, credential storage, and optional webhook handling. Start with IMAP polling; add webhooks when you need real-time reactivity.
- Build the email UI (if showing email in-app) or provide credentials (if users connect their own client).
- Handle cleanup: Delete inboxes when users or resources are removed. Implement proper offboarding flows for compliance.
For prototyping, start with 3-5 managed inboxes ($9-15 total) and validate the architecture end to end before committing to the whitelabel tier. For SMTP testing during development, disposable inboxes let you verify email flows without any infrastructure setup.
The gap between "our product needs email inboxes" and "our users have email inboxes" does not require a mail server. It requires an API call.
FAQ
How long does it take to integrate email inboxes into an existing SaaS product?
For a basic integration (inbox provisioning, IMAP reading, SMTP sending), most teams complete the work in 1-2 weeks. Adding webhooks for real-time processing and building an in-app email UI takes an additional 2-4 weeks. Compare this to 2-4 months for setting up and stabilizing self-hosted mail infrastructure.
Can my users send email from their managed inbox, not just receive?
Yes. Every managed inbox has SMTP credentials that allow sending email. Your backend connects to smtp.reusable.email:587 with the inbox's credentials and sends on behalf of the user. The email appears to come from the inbox address with proper authentication headers (SPF, DKIM).
What happens if a user receives a large volume of spam?
Managed inboxes include spam filtering. Spam is filtered server-side before it reaches the inbox, similar to how Gmail or Outlook filter spam. For the whitelabel tier, you can configure additional filtering rules via the admin panel. If a specific inbox receives targeted spam, you can change the inbox address or add blocking rules.
Can I use Reusable.Email alongside my existing email sending service (SendGrid, SES)?
Absolutely. This is the recommended architecture. Use your existing sending service for outbound transactional email (welcome emails, notifications, marketing) and Reusable.Email for receiving inboxes. The two services handle different parts of the email pipeline and complement each other. Your sending service optimizes deliverability for outbound; Reusable.Email provides inboxes for inbound.
How do I handle email threading and conversation grouping in my UI?
Email threading uses the In-Reply-To and References headers defined in RFC 5322. When your backend fetches emails via IMAP, parse these headers to group messages into conversations. Most email libraries (Python's email module, Node.js's mailparser) extract these headers automatically. Build your conversation view by grouping messages that share References or In-Reply-To values.
Try it free
Get a disposable inbox in seconds
No sign-up required. Just visit an address and it's live. Works with any domain on reusable.email.
Open your inbox →

