Postal is a powerful open-source email platform that allows you to manage your own SMTP server for sending transactional and bulk emails. It provides a web interface, API, and SMTP access similar to services like SendGrid or Mailgun.
This guide shows how to install Postal on a VPS server using Docker, as well as how to configure DNS records for proper email delivery.
Minimum system requirements
- Ubuntu 22.04 server
- Minimum 4 GB RAM
- 2 CPU cores
- Public IP address
- Domain with DNS access
Step 1 – Prepare the server
ssh root@SERVER_IP
apt update && apt upgrade -y
apt install git curl jq -y
Step 2 – Install Docker
curl -fsSL https://get.docker.com | sh
docker --version
Postal runs entirely on Docker and cannot be used without it.
Step 3 – Configure Hostname, A record and Reverse DNS (PTR)
Correct hostname and DNS configuration is essential for email delivery and SSL issuance.
Set hostname
hostnamectl set-hostname postal.example.com
Edit hosts file:
nano /etc/hosts
127.0.0.1 localhost
SERVER_IP postal.example.com postal
Configure A record
postal.example.com → SERVER_IP
Configure PTR (Reverse DNS)
SERVER_IP → postal.example.com
Important: Hostname, A record and PTR must match exactly.
Step 4 – Install Postal helper
git clone https://github.com/postalserver/install /opt/postal/install
ln -s /opt/postal/install/bin/postal /usr/bin/postal
Step 5 – Start MariaDB (Docker)
docker run -d \
--name postal-mariadb \
-p 127.0.0.1:3306:3306 \
--restart always \
-e MARIADB_DATABASE=postal \
-e MARIADB_ROOT_PASSWORD=StrongPassword \
mariadb
Step 6 – Generate configuration
postal bootstrap postal.example.com
Step 7 – Configure Postal
nano /opt/postal/config/postal.yml
main_db:
host: 127.0.0.1
username: root
password: StrongPassword
database: postal
Step 8 – Initialize Postal
postal initialize
postal make-user
Step 9 – Start Postal
postal start
postal status
Step 10 – Start Caddy (Docker)
docker run -d \
--name postal-caddy \
--restart always \
--network host \
-v /opt/postal/config/Caddyfile:/etc/caddy/Caddyfile \
-v /opt/postal/caddy-data:/data \
caddy
Step 11 – DNS configuration
MX record
postal.example.com → postal.example.com
SPF record
v=spf1 ip4:SERVER_IP ~all
DKIM record
Will be generated in the Postal interface.
Return-Path domain
rp.postal.example.com → SERVER_IP
Step 12 – Access Postal
https://postal.example.com
Step 13 – Create SMTP server
- Create Organization
- Create Mail Server
- Add domain
- Generate SMTP credentials
Example SMTP configuration
SMTP Host: postal.example.com
SMTP Port: 587
Encryption: TLS
Username: your_username
Password: your_password
Step 14 – Upgrade Postal
cd /opt/postal/install
git pull
postal update
postal restart
Conclusion
Postal runs entirely on Docker and uses containers for MariaDB and Caddy. With proper DNS configuration and correct hostname setup, you can achieve reliable email delivery.