This white paper defines a practical architecture for operating a secure, self-hosted business email service on a Contabo VPS using Docker Mailserver (DMS). It also defines the complementary roles of KeenComputer.com as the implementation and managed-operations partner, IAS-Research.com as the research and systems-engineering partner, and Open-Xchange (OX) as a commercial email and collaboration platform option for organizations that require enterprise-scale groupware.
The solution combines Postfix-based SMTP, Dovecot-based IMAP, TLS encryption, DKIM signing, spam filtering, Fail2ban protection, persistent Docker volumes, and standardized DNS authentication. Docker Mailserver’s official deployment model publishes ports 25, 465, 587, and 993 and stores mail, state, logs, and configuration in persistent volumes.
This document is intended for business owners, IT leaders, DevOps engineers, managed-service providers, and software teams evaluating email infrastructure options.
White Paper: Business and Engineering Reference Architecture for Self-Hosted Email on a Contabo VPS
Executive summary
This white paper defines a practical architecture for operating a secure, self-hosted business email service on a Contabo VPS using Docker Mailserver (DMS). It also defines the complementary roles of KeenComputer.com as the implementation and managed-operations partner, IAS-Research.com as the research and systems-engineering partner, and Open-Xchange (OX) as a commercial email and collaboration platform option for organizations that require enterprise-scale groupware.
The solution combines Postfix-based SMTP, Dovecot-based IMAP, TLS encryption, DKIM signing, spam filtering, Fail2ban protection, persistent Docker volumes, and standardized DNS authentication. Docker Mailserver’s official deployment model publishes ports 25, 465, 587, and 993 and stores mail, state, logs, and configuration in persistent volumes.
This document is intended for business owners, IT leaders, DevOps engineers, managed-service providers, and software teams evaluating email infrastructure options.
Business context
Email remains a mission-critical communication, identity, and workflow channel for businesses. A self-hosted mail platform can provide greater control over mailboxes, data residency, branding, retention, integration, and operating costs than a fully managed mailbox service.
However, self-hosting is not simply “installing software.” A production email system must protect against spoofing, phishing, credential abuse, spam, malware, data loss, and IP-reputation problems. The architecture in this paper is therefore designed around security, deliverability, recoverability, and operational simplicity.
Business benefits
|
Benefit |
Business impact |
|---|---|
|
Data control |
Mailboxes and message data remain under the organization’s control |
|
Professional identity |
Employees use addresses on the company domain |
|
Cost predictability |
Fixed VPS and storage costs can be planned |
|
Integration |
Mail can integrate with internal applications and automation |
|
Security control |
TLS, authentication, filtering, and access controls are centrally managed |
|
Portability |
Docker Compose configuration and persistent volumes support recovery and migration |
|
Collaboration readiness |
Commercial platforms such as Open-Xchange can add calendars, contacts, files, and document collaboration |
Business risks
|
Risk |
Mitigation |
|---|---|
|
Poor deliverability |
Correct A, MX, PTR, SPF, DKIM, and DMARC configuration |
|
Phishing and spoofing |
SPF, DKIM, DMARC, TLS, and user security awareness |
|
Hardware or provider failure |
Off-site encrypted backups and documented recovery procedures |
|
Compromised credentials |
Strong passwords, Fail2ban, least privilege, and monitoring |
|
Malware or spam |
Rspamd/ClamAV filtering and ongoing log review |
|
Compliance obligations |
Retention policy, access controls, encryption, and audit logging |
|
Operational skill gap |
Managed implementation and support through KeenComputer.com |
SPF and DKIM allow receiving domains to verify that a sender was authorized by the sending domain, while DMARC builds on both protocols to give domain owners control over unauthenticated mail.
Stakeholder roles
The proposed delivery model separates strategic research, implementation, operations, and commercial software licensing.
|
Organization |
Role |
Primary responsibilities |
|---|---|---|
|
KeenComputer.com |
Implementation, integration, and managed-operations partner |
VPS deployment, Linux/Docker configuration, security hardening, monitoring, backup, recovery, user support, and ongoing maintenance |
|
IAS-Research.com |
Research, architecture, and systems-engineering partner |
Requirements analysis, architecture review, security research, integration design, technical documentation, and advanced engineering support |
|
Contabo |
Infrastructure provider |
VPS compute, storage, public IP, network access, DNS management, and reverse DNS/PTR configuration |
|
Docker Mailserver |
Open-source mail-stack platform |
Postfix SMTP, Dovecot IMAP, Rspamd, ClamAV, Fail2ban, DKIM, and TLS integration |
|
Open-Xchange / OX App Suite |
Commercial collaboration and email platform |
Webmail, calendar, contacts, tasks, cloud storage, document collaboration, enterprise administration, and optional commercial support |
|
Business customer |
Service owner |
Defines users, policies, compliance requirements, budget, and acceptance criteria |
KeenComputer positions itself as an implementation, integration, and operations partner for VPS deployment, Linux, Docker, security, monitoring, backups, and recovery. IAS-Research describes itself as a multidisciplinary engineering and innovation organization providing systems engineering, full-stack software engineering, DevOps, IoT, and research-based consulting.[keencomputer][keencomputer][ias-research][ias-research]
Solution overview
The baseline architecture uses a single Contabo VPS running Docker and Docker Mailserver. DMS packages the core mail services into a containerized deployment, reducing the operational burden of installing and maintaining Postfix, Dovecot, anti-spam, antivirus, and TLS components separately.
Internet | | SMTP port 25 v +--------------------------------------+ | Contabo VPS | |--------------------------------------| | Docker Engine | | Docker Mailserver | | - Postfix / SMTP | | - Dovecot / IMAP | | - Rspamd / ClamAV | | - Fail2ban | | - DKIM signing | | - TLS certificates | | | | Optional: Open-Xchange App Suite | +--------------------------------------+ | +-- Persistent mail data +-- Persistent mail state +-- Persistent logs +-- Persistent configuration | +-- KeenComputer managed operations +-- IAS-Research architecture and research support
Core components
|
Component |
Function |
|---|---|
|
Contabo VPS |
Provides compute, storage, public IP, and network connectivity |
|
Docker Engine |
Runs and isolates the mail workload |
|
Docker Mailserver |
Provides SMTP, IMAP, TLS, authentication, filtering, and DKIM |
|
Postfix |
Handles SMTP message transfer |
|
Dovecot |
Provides IMAP mailbox access |
|
Rspamd |
Filters spam and applies mail policy |
|
ClamAV |
Scans attachments for malware |
|
Fail2ban |
Blocks repeated authentication failures |
|
Let’s Encrypt |
Provides TLS certificates |
|
DNS |
Routes mail and validates sender identity |
|
Reverse DNS/PTR |
Maps the VPS IP to the mail hostname |
|
Open-Xchange |
Optional commercial webmail, collaboration, and groupware layer |
Platform options
Organizations should choose between the open-source baseline and a commercial collaboration platform based on user count, support requirements, feature needs, and internal engineering capacity.
|
Option |
Best for |
Advantages |
Considerations |
|---|---|---|---|
|
Docker Mailserver |
Small businesses, technical teams, pilots |
Low software cost, simple Docker deployment, strong open-source ecosystem |
Requires internal or partner-managed operations |
|
Docker Mailserver + Open-Xchange |
Businesses needing webmail and collaboration |
Adds webmail, calendar, contacts, tasks, files, and collaboration |
Additional licensing, integration, and operational complexity |
|
Managed email provider |
Organizations prioritizing simplicity |
Provider handles uptime, security, and deliverability |
Less infrastructure control and potentially higher recurring cost |
|
Open-Xchange / Dovecot Pro |
ISPs, hosters, large enterprises |
Commercial support, scalable mail backend, enterprise collaboration features |
Higher cost and more complex deployment |
Open-Xchange’s OX App Suite is a modular platform that includes email, calendar, contacts, tasks, portal, and settings; optional modules include Drive, Documents, Guard, and mobile synchronization through Exchange ActiveSync. OX Dovecot Pro is a commercial mail backend designed for scalability and is positioned for large telcos, ISPs, and hosting providers.[documentation.open-xchange][documentation.open-xchange][doc.dovecotpro][open-xchange]
Role of KeenComputer.com
KeenComputer.com acts as the implementation, integration, and managed-operations partner. Its role is to translate the business requirements and technical architecture into a working, secure, monitored, and supportable email service.
KeenComputer’s published service model includes VPS deployment, Linux and cloud infrastructure, Docker, security hardening, UFW firewall configuration, monitoring, backup, recovery, managed hosting, and ongoing support.[keencomputer][keencomputer][keencomputer]
KeenComputer responsibilities
|
Phase |
KeenComputer responsibilities |
|---|---|
|
Assessment |
Review business needs, mailbox count, domain setup, compliance needs, and existing email migration requirements |
|
Architecture |
Select VPS size, mail hostname, DNS design, backup strategy, and security controls |
|
Implementation |
Deploy the Contabo VPS, install Docker, deploy Docker Mailserver, configure TLS and firewall rules |
|
DNS and deliverability |
Configure A, MX, SPF, DKIM, DMARC, and reverse DNS/PTR records |
|
Identity and access |
Create mailbox accounts, enforce strong passwords, and configure SSH access |
|
Security |
Harden the VPS, configure Fail2ban, enable Rspamd/ClamAV, and review logs |
|
Client deployment |
Configure Thunderbird, iPhone/iPad, Outlook, or other supported clients |
|
Monitoring |
Monitor service health, disk usage, TLS expiry, mail queues, and authentication failures |
|
Backup and recovery |
Implement scheduled backups and validate restoration procedures |
|
Support |
Provide incident response, patching, user support, and operational reporting |
KeenComputer service model
A practical commercial engagement could include:
- Email infrastructure assessment: domain, DNS, mailbox, migration, security, and compliance review.
- VPS and Docker deployment: provisioning, hardening, Docker installation, and DMS configuration.
- Deliverability engineering: DNS, SPF, DKIM, DMARC, PTR, and blocklist monitoring.
- Mailbox administration: account creation, password policy, aliases, forwarding, and distribution lists.
- Client onboarding: Thunderbird, Apple Mail, iPhone, iPad, and Outlook configuration.
- Managed operations: monitoring, patching, backups, incident response, and monthly reporting.
- Migration support: controlled migration from Google Workspace, Microsoft 365, or an existing mail server.
KeenComputer’s published materials describe managed hosting, server administration, SSL/TLS configuration, backup scheduling and restoration testing, monitoring, incident assistance, and technical support.[keencomputer][keencomputer]
Role of IAS-Research.com
IAS-Research.com acts as the research, architecture, and systems-engineering partner. Its role is to ensure that the email deployment is designed as a reliable system rather than as a collection of isolated software components.
IAS-Research describes its work as solving complex multidisciplinary problems through a systems-engineering approach, with capabilities in full-stack software engineering, DevOps, cloud-native applications, IoT, network management, and research consulting.[ias-research][ias-research][ias-research]
IAS-Research responsibilities
|
Area |
IAS-Research contribution |
|---|---|
|
Business and technical requirements |
Define user, security, availability, retention, integration, and compliance requirements |
|
Systems architecture |
Design the end-to-end mail, identity, DNS, backup, and monitoring architecture |
|
Security research |
Review authentication, encryption, spam controls, threat models, and incident-response procedures |
|
Integration design |
Define APIs, automation, directory integration, logging, and monitoring interfaces |
|
Deliverability engineering |
Develop SPF, DKIM, DMARC, PTR, and reputation-management procedures |
|
Documentation |
Produce engineering specifications, runbooks, test plans, and operational procedures |
|
Research and innovation |
Evaluate emerging email-security, AI-assisted operations, and automation capabilities |
|
Quality assurance |
Define acceptance criteria and validate the deployment against business requirements |
IAS-Research and KeenComputer operating model
Business requirements | v IAS-Research.com Architecture, research, security, integration design | v KeenComputer.com Implementation, deployment, operations, monitoring, support | v Contabo VPS + Docker Mailserver Production email service | v Business users and clients
In this model, IAS-Research provides the engineering and research foundation, while KeenComputer provides day-to-day implementation and operational ownership. This division reduces the risk of deploying email infrastructure without adequate security, monitoring, documentation, or support.
Role of commercial email server: Open-Xchange
Open-Xchange (OX) is the commercial email and collaboration option in the architecture. It is appropriate when the business requires more than basic SMTP and IMAP mailboxes, particularly webmail, shared calendars, contacts, tasks, cloud files, document collaboration, and enterprise administration.
Open-Xchange provides OX App Suite, a modular self-hosted email and collaboration platform. Its core modules include OX Mail, Calendar, Contacts, Tasks, Portal, and Settings; optional modules include OX Drive, OX Documents, OX Guard, and mobile synchronization through the Connector for Business Mobility.[documentation.open-xchange][ox]
Open-Xchange capabilities
|
Capability |
Business value |
|---|---|
|
OX Mail |
Browser-based email access and mailbox management |
|
Calendar |
Shared scheduling, appointments, and meeting coordination |
|
Contacts |
Shared business contact management |
|
Tasks |
Task assignment and collaboration |
|
OX Drive |
Cloud file storage and sharing |
|
OX Documents |
Browser-based document collaboration |
|
OX Guard |
Email and file encryption capability |
|
Mobile synchronization |
Email, calendar, and contact synchronization for supported devices |
|
Enterprise administration |
Centralized user, policy, and service administration |
OX App Suite uses a Java-based middleware layer for authentication, data storage, retrieval, and permission enforcement across its applications.[documentation.open-xchange][documentation.open-xchange]
When to use Open-Xchange
Use Open-Xchange when the organization needs:
- A professional webmail interface for non-technical users.
- Shared calendars, contacts, and tasks.
- Cloud file storage and document collaboration.
- Enterprise administration and policy controls.
- Commercial support and predictable product lifecycle management.
- Integration with existing business applications.
- A scalable platform for many users or multiple organizations.
Use Docker Mailserver alone when the organization needs only reliable SMTP and IMAP mailboxes and has adequate technical operations capacity.
Open-Xchange integration model
Business users | +-- Thunderbird / Apple Mail / Outlook | +-- OX App Suite web interface | v OX App Suite Middleware | v Postfix / Dovecot mail backend | v Contabo VPS and persistent storage
Open-Xchange documentation also describes OAuth 2.0-based authentication using Dovecot SASL mechanisms and Postfix SMTP authentication, which can support modern identity-provider integration in suitable deployments.[documentation.open-xchange]
Infrastructure requirements
VPS sizing
|
Deployment profile |
CPU |
RAM |
Storage |
Recommended use |
|---|---|---|---|---|
|
Personal or pilot |
1 vCPU |
2 GB |
40 GB |
1–3 mailboxes |
|
Small business |
2 vCPU |
4 GB |
80 GB |
5–20 mailboxes |
|
Growing business |
4 vCPU |
8 GB |
160 GB or more |
20–50 mailboxes |
|
Open-Xchange deployment |
4 vCPU or more |
8 GB or more |
160 GB or more |
Webmail, collaboration, and multiple users |
|
High-volume organization |
Dedicated server or managed mail platform |
16 GB or more |
Sized by retention policy |
High-volume or compliance-heavy workloads |
For a small business deployment, use at least 4 GB RAM if Rspamd and ClamAV are enabled. The official Docker Mailserver basic-install example includes ENABLE_RSPAMD=1 and ENABLE_CLAMAV=1, which increases resource consumption.
Operating system and network
Use a supported LTS release, preferably Ubuntu 24.04 LTS. The VPS requires a static public IPv4 address, outbound TCP port 25 access, inbound mail ports, and port 80 for Let’s Encrypt validation.
Required inbound ports are:
|
Port |
Protocol |
Purpose |
|---|---|---|
|
25 |
SMTP |
Server-to-server mail delivery |
|
465 |
SMTPS |
Implicit TLS mail submission |
|
587 |
SMTP submission |
STARTTLS mail submission |
|
993 |
IMAPS |
Encrypted mailbox access |
|
80 |
HTTP |
Let’s Encrypt validation |
|
443 |
HTTPS |
Optional webmail or Open-Xchange interface |
Docker Mailserver’s official reference deployment maps ports 25, 465, 587, and 993.
Domain and DNS design
Use a dedicated mail hostname rather than the root domain:
mail.example.com
This separation makes it easier to migrate mail infrastructure, issue TLS certificates, and manage reverse DNS.
Required DNS records
|
Record type |
Name |
Value |
Purpose |
|---|---|---|---|
|
A |
|
VPS IPv4 address |
Maps the mail hostname to the VPS |
|
AAAA |
|
VPS IPv6 address |
Optional IPv6 support |
|
MX |
@ |
mail.example.com, priority 10 |
Directs inbound mail |
|
TXT |
@ |
v=spf1 mx -all |
SPF authorization |
|
TXT |
mail._domainkey |
DKIM public key |
Validates DKIM signatures |
|
TXT |
_dmarc |
DMARC policy and reporting address |
Prevents domain spoofing |
Example DNS zone
For example.com and VPS IP 203.0.113.10:
example.com. IN MX 10 mail.example.com. mail.example.com. IN A 203.0.113.10 example.com. IN TXT "v=spf1 mx -all" mail._domainkey.example.com. IN TXT "v=DKIM1; k=rsa; p=PUBLIC_DKIM_KEY" _dmarc.example.com. IN TXT "v=DMARC1; p=none; rua=mailto:
Docker Mailserver identifies the MX record, mail-server A record, and PTR record as foundational requirements for mail delivery.
Reverse DNS requirement
Reverse DNS, or PTR, maps the VPS IP address back to mail.example.com. It is a critical deliverability control because many receiving mail systems validate that the sending IP resolves back to a credible hostname.
Configure the PTR record in the Contabo Customer Panel:
203.0.113.10 -> mail.example.com
Contabo provides self-service DNS management for A, AAAA, MX, TXT, SRV, and CNAME records, as well as reverse DNS for IPv4 and IPv6.
Verify:
dig -x 203.0.113.10 +short
Expected output:
mail.example.com.
Security architecture
Transport encryption
|
Service |
Recommended port |
Encryption |
|---|---|---|
|
IMAP |
993 |
SSL/TLS |
|
SMTP submission |
465 |
Implicit TLS |
|
SMTP submission |
587 |
STARTTLS |
|
SMTP relay |
25 |
Opportunistic or enforced TLS |
Docker Mailserver recommends IMAP on port 993 and SMTP submission on port 587 or 465; its FAQ notes that port 465 is preferred where supported.
Email authentication
Implement all three mechanisms:
- SPF validates the sending IP address against the domain’s authorized senders.
- DKIM cryptographically signs outbound messages.
- DMARC defines how receiving systems handle messages that fail SPF or DKIM validation.
M3AAWG recommends that senders publish SPF, sign mail with DKIM, publish a DMARC policy, and align SPF or DKIM with the visible From domain.
Recommended DMARC rollout
Start with monitoring-only mode:
v=DMARC1; p=none; rua=mailto:
After reviewing reports and confirming legitimate mail flow, move to quarantine:
v=DMARC1; p=quarantine; rua=mailto:
Finally, enforce rejection:
v=DMARC1; p=reject; rua=mailto:
DMARC is designed to prevent unauthorized use of a domain in the From header and gives domain owners visibility into authentication failures.
Access control
- Use SSH key authentication rather than password authentication.
- Disable direct root SSH access after creating an administrative user.
- Use strong, unique mailbox passwords.
- Restrict SMTP relay access to authenticated users.
- Enable Fail2ban to limit brute-force authentication attempts.
- Apply least privilege to administrative accounts.
- Use separate credentials for mail access, administration, and backups.
- Encrypt and store backups outside the VPS.
Deployment procedure
Provision the Contabo VPS
- Log in to the Contabo Customer Panel.
- Create a VPS using Ubuntu 24.04 LTS.
- Select a plan with adequate CPU, RAM, and storage.
- Add an SSH public key.
- Record the assigned public IPv4 address.
- Connect using SSH.
Initialize the server
sudo apt update sudo apt upgrade -y sudo apt install -y curl git ufw fail2ban
Set the mail hostname:
sudo hostnamectl set-hostname mail.example.com
Add the hostname to /etc/hosts:
echo "203.0.113.10 mail.example.com mail" | sudo tee -a /etc/hosts
Create an administrative user
adduser mailadmin usermod -aG sudo mailadmin
Upload the SSH public key:
PermitRootLogin no PasswordAuthentication no
Docker deployment
Install Docker
sudo apt update sudo apt install -y ca-certificates curl gnupg sudo install -m 0755 -d /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \ sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \ https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt update sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Verify:
docker --version docker compose version
Create project directories
mkdir -p ~/mailserver/docker-data/dms/{mail-data,mail-state,mail-logs,config} cd ~/mailserver
Create Docker Compose configuration
Create:
nano docker-compose.yml
Use:
services: mailserver: image: ghcr.io/docker-mailserver/docker-mailserver:latest container_name: mailserver hostname: mail.example.com ports: - "25:25" - "465:465" - "587:587" - "993:993" volumes: - ./docker-data/dms/mail-data/:/var/mail/ - ./docker-data/dms/mail-state/:/var/mail-state/ - ./docker-data/dms/mail-logs/:/var/log/mail/ - ./docker-data/dms/config/:/tmp/docker-mailserver/ - /etc/localtime:/etc/localtime:ro - /etc/letsencrypt:/etc/letsencrypt:ro environment: - ENABLE_RSPAMD=1 - ENABLE_CLAMAV=1 - ENABLE_FAIL2BAN=1 - SSL_TYPE=letsencrypt - SPOOF_PROTECTION=1 cap_add: - NET_ADMIN restart: always
This configuration follows Docker Mailserver’s documented basic installation, including persistent mail, state, log, and configuration volumes; Rspamd, ClamAV, and Fail2ban; and the required mail ports.
TLS certificate management
Install Certbot:
sudo apt install -y certbot
Issue the certificate:
sudo certbot certonly --standalone -d mail.example.com
If port 80 is already in use, stop the mail stack temporarily:
cd ~/mailserver docker compose down sudo certbot certonly --standalone -d mail.example.com docker compose up -d
Protect the private key:
sudo chmod 600 /etc/letsencrypt/live/mail.example.com/privkey.pem sudo chown root:root /etc/letsencrypt/live/mail.example.com/privkey.pem
Docker Mailserver supports Let’s Encrypt certificates through SSL_TYPE=letsencrypt, provided the certificate files are available to the container.
Start the service
cd ~/mailserver docker compose up -d
Verify:
docker compose ps docker logs -f mailserver
Mailbox provisioning
Create the first mailbox immediately after startup:
docker exec -it mailserver setup email add
Create additional mailboxes:
docker exec -it mailserver setup email add
List accounts:
docker exec -it mailserver setup email list
Docker Mailserver requires at least one mailbox account after first startup and provides setup email add for account creation.
DKIM deployment
Generate the DKIM key:
docker exec -it mailserver setup config dkim
Locate the generated DNS record:
sudo cat ~/mailserver/docker-data/dms/config/opendkim/keys/example.com/mail.txt
Publish the displayed v=DKIM1; k=rsa; p=... value as:
mail._domainkey.example.com
Restart the service so outgoing mail is signed:
docker compose up --force-recreate
Docker Mailserver documents DKIM generation through setup config dkim and notes that outgoing mail is signed after the service is recreated.
Firewall configuration
sudo ufw allow OpenSSH sudo ufw allow 25/tcp sudo ufw allow 465/tcp sudo ufw allow 587/tcp sudo ufw allow 993/tcp sudo ufw allow 80/tcp sudo ufw allow 443/tcp sudo ufw enable sudo ufw status
Client configuration
Use IMAP for desktop and mobile clients so mailbox folders and message state remain synchronized across devices.
|
Setting |
Incoming mail |
Outgoing mail |
|---|---|---|
|
Server hostname |
mail.example.com |
mail.example.com |
|
Protocol |
IMAP |
SMTP |
|
Port |
993 |
465 or 587 |
|
Encryption |
SSL/TLS |
SSL/TLS or STARTTLS |
|
Authentication |
Normal password |
Normal password |
|
Username |
Full email address |
Full email address |
|
Password |
Mailbox password |
Mailbox password |
Docker Mailserver identifies mail.example.com, IMAP port 993, and SMTP ports 587 or 465 as the recommended client configuration.
Thunderbird
- Open Thunderbird.
- Select Account Settings → Account Actions → Add Mail Account.
- Enter the user’s full email address and password.
- Select Configure manually.
- Configure the incoming server:
- Protocol: IMAP
- Hostname: mail.example.com
- Port: 993
- Security: SSL/TLS
- Authentication: Normal password
- Username: full email address
- Configure the outgoing server:
- Hostname: mail.example.com
- Port: 465 or 587
- Security: SSL/TLS or STARTTLS
- Authentication: Normal password
- Username: full email address
- Select Re-test, then Done.
Thunderbird’s manual account configuration requires the incoming and outgoing server hostnames, ports, security settings, and authentication details.
iPhone and iPad
- Open Settings.
- Go to Apps → Mail → Mail Accounts.
- Tap Add Account.
- Enter the email address and tap Next.
- Select Add Other Account → Mail Account.
- Enter the user’s name, email address, password, and description.
- Tap Next and select IMAP.
- Enter mail.example.com for both incoming and outgoing servers.
- Enter the full email address and mailbox password for both server credentials.
- Tap Next, then Save.
Apple Mail supports manual account setup when automatic configuration is unavailable.
Engineering test plan
Infrastructure tests
|
Test |
Command |
Expected result |
|---|---|---|
|
Docker service |
docker compose ps |
mailserver is running |
|
DNS A record |
dig A mail.example.com +short |
Returns VPS IP |
|
MX record |
dig MX example.com +short |
Returns mail.example.com |
|
SPF record |
dig TXT example.com +short |
Returns SPF policy |
|
DKIM record |
dig TXT mail._domainkey.example.com +short |
Returns DKIM public key |
|
DMARC record |
dig TXT _dmarc.example.com +short |
Returns DMARC policy |
|
Reverse DNS |
dig -x VPS_IP +short |
Returns mail.example.com |
TLS tests
openssl s_client -connect mail.example.com:993 openssl s_client -connect mail.example.com:587 -starttls smtp openssl s_client -connect mail.example.com:465
Each test should establish a valid TLS session and present a certificate for mail.example.com.
Mail-flow tests
|
Test |
Procedure |
Pass criterion |
|---|---|---|
|
Outbound delivery |
Send from |
Message is accepted |
|
Inbound delivery |
Send from an external address to |
Message reaches the mailbox |
|
Authentication |
Send through Thunderbird or iPhone |
SMTP authentication succeeds |
|
TLS |
Inspect client connection settings |
SSL/TLS or STARTTLS is active |
|
DKIM validation |
Inspect Gmail message headers |
DKIM: PASS |
|
SPF validation |
Inspect Gmail message headers |
SPF: PASS |
|
DMARC validation |
Inspect Gmail message headers |
DMARC: PASS |
|
Spam handling |
Send a known spam sample in a controlled test |
Message is filtered or flagged |
|
Failure recovery |
Restart Docker and verify mailbox access |
Mail and configuration remain available |
Operations and monitoring
Daily operations
- Review Docker and mail logs.
- Verify that the container is running.
- Monitor disk usage.
- Review failed-login and spam-filter events.
- Confirm backup completion.
- Review DMARC aggregate reports.
Useful commands
cd ~/mailserver docker compose ps docker logs --tail 300 mailserver docker exec -it mailserver doveadm who df -h docker system df
Log locations
Docker Mailserver mounts persistent log storage at:
~/mailserver/docker-data/dms/mail-logs/
Review logs with:
docker logs --tail 200 mailserver docker exec -it mailserver tail -n 200 /var/log/mail/mail.log
Backup and recovery
Backup scope
Back up:
- docker-compose.yml
- docker-data/dms/config/
- docker-data/dms/mail-data/
- docker-data/dms/mail-state/
- TLS certificate metadata, where applicable
- DNS zone records
- Mailbox credentials and recovery procedures
Backup command
cd ~/mailserver tar -czf mailserver-backup-$(date +%F).tar.gz \ docker-compose.yml \ docker-data/dms/config \ docker-data/dms/mail-data \ docker-data/dms/mail-state
Transfer the archive off the VPS:
scp mailadmin@YOUR_SERVER_IP:~/mailserver/mailserver-backup-*.tar.gz .
Recovery procedure
- Provision a replacement Contabo VPS.
- Install Docker and Docker Compose.
- Restore the project directory and persistent volumes.
- Restore or reissue the TLS certificate.
- Restore DNS records if the IP address changes.
- Update the Contabo reverse DNS/PTR record if the IP changes.
- Start Docker Mailserver.
- Validate mail flow and authentication.
- Confirm mailbox access from Thunderbird and mobile clients.
Change management
Use a controlled release process:
- Back up configuration and mail data.
- Review Docker Mailserver release notes.
- Pull the updated image in a maintenance window.
- Recreate the container.
- Run the infrastructure, TLS, and mail-flow test plan.
- Monitor logs for at least 24 hours.
- Roll back using the prior image tag or restored volumes if necessary.
Update commands:
cd ~/mailserver docker compose pull docker compose up -d docker image prune -f
Persistent volumes preserve mail and configuration across container restarts and image updates.
Incident response
|
Incident |
Immediate response |
Follow-up |
|---|---|---|
|
Compromised mailbox |
Reset password, revoke active sessions, review sent mail |
Enable MFA where supported, review logs |
|
Spam outbreak |
Identify compromised account, disable sending, reset credentials |
Review filtering rules and logs |
|
Delivery failure |
Check DNS, PTR, TLS, and provider bounce messages |
Correct configuration and retest |
|
Certificate expiration |
Renew certificate and restart service |
Verify automatic renewal |
|
Disk exhaustion |
Expand storage or archive old mail |
Implement retention and monitoring |
|
Container failure |
Review logs and restart service |
Identify root cause and patch configuration |
Acceptance criteria
The deployment is production-ready when all of the following are true:
- The mail hostname resolves correctly through forward and reverse DNS.
- MX records point to the mail hostname.
- TLS certificates are valid and automatically renewable.
- Mailboxes can send and receive messages.
- Thunderbird and iPhone/iPad clients can authenticate successfully.
- Outbound messages pass SPF, DKIM, and DMARC validation.
- Rspamd and ClamAV are enabled.
- Fail2ban is active.
- Backups are automated and stored off-site.
- Logs, disk usage, TLS expiry, and deliverability are monitored.
- KeenComputer operational support and escalation procedures are documented.
- IAS-Research architecture, security, and integration documentation are approved.
Recommendations
For most small and medium-sized businesses, the recommended implementation is:
- Use a dedicated Contabo VPS for email.
- Deploy Docker Mailserver using Docker Compose.
- Use mail.example.com as the mail hostname.
- Enable Rspamd, ClamAV, and Fail2ban.
- Use IMAP on port 993 and SMTP submission on port 465 or 587.
- Configure SPF, DKIM, DMARC, and reverse DNS before production use.
- Begin DMARC at p=none, then progress to p=quarantine and p=reject.
- Maintain encrypted, off-site backups.
- Engage KeenComputer.com for implementation, security hardening, monitoring, backup, and managed support.
- Engage IAS-Research.com for architecture, research, systems engineering, integration design, and technical documentation.
- Evaluate Open-Xchange when the business needs commercial webmail, collaboration, calendars, contacts, files, and enterprise-grade administration.
For organizations with strict compliance, high-volume sending, or complex mailbox requirements, evaluate a managed email platform or hybrid architecture in which outbound mail is relayed through a reputable SMTP provider while inbound mail remains self-hosted.
References
- Docker Mailserver, Basic Installation: persistent volumes, required ports, Rspamd, ClamAV, Fail2ban, and mailbox provisioning.
- Docker Mailserver, FAQ: client ports, IMAP/SMTP configuration, and DNS authentication requirements.
- Docker Mailserver, DKIM, DMARC & SPF: DKIM generation and signing workflow.
- Docker Mailserver, Usage: MX, A, PTR, and first-account setup requirements.
- Contabo, Domain Management and DNS Management: DNS records and reverse DNS management.
- Contabo, Reverse DNS (rDNS): PTR record purpose and provider-managed reverse DNS.
- KeenComputer.com: implementation, integration, managed hosting, VPS security, monitoring, backup, and recovery services.[keencomputer][keencomputer][keencomputer][keencomputer]
- IAS-Research.com: systems engineering, full-stack software engineering, DevOps, IoT, research, and consulting capabilities.[ias-research][ias-research][ias-research]
- Open-Xchange, OX App Suite and Dovecot Pro: commercial email, collaboration, middleware, and scalable mail-backend capabilities.[documentation.open-xchange][documentation.open-xchange][doc.dovecotpro][open-xchange][ox]
- M3AAWG, Email Authentication and Sender Best Common Practices: SPF, DKIM, and DMARC guidance.
- Mozilla, Manual Account Configuration: Thunderbird client configuration requirements.
- Apple Support, Add an email account to your iPhone or iPad: manual IMAP/SMTP account setup.