How to Install Postal SMTP Server and Configure DNS (SPF, DKIM, DMARC)

Postal is a powerful open-source mail delivery platform that allows you to run your own SMTP server for sending transactional and bulk emails. It provides a web interface, API access, and SMTP credentials similar to services like SendGrid or Mailgun.

This tutorial explains how to install Postal on a VPS and configure DNS records including SPF, DKIM and DMARC to ensure proper email deliverability.

Minimum Server Requirements

  • Ubuntu 22.04 server
  • 4 GB RAM (minimum)
  • 2 CPU cores
  • 25 GB disk space
  • Dedicated public IP address
  • Full DNS access to your domain

Recommended Domain Structure

Example domain setup:

postal.example.com → Postal server
example.com → your main website

Step 1 – Prepare Your Server

Connect to your server:

ssh root@SERVER_IP

Update the system:

apt update && apt upgrade -y

Install dependencies:

apt install git curl jq unzip -y

Step 2 – Install Docker

Postal runs inside Docker containers.

curl -fsSL https://get.docker.com | sh

Install Docker Compose plugin:

apt install docker-compose-plugin -y

Verify installation:

docker --version

Step 3 – Install Postal

git clone https://github.com/postalserver/install /opt/postal/install
ln -s /opt/postal/install/bin/postal /usr/bin/postal

Step 4 – Generate Postal Configuration

postal bootstrap postal.example.com

This creates configuration files inside:

/opt/postal/config

Step 5 – Configure Postal

Edit the configuration file:

nano /opt/postal/config/postal.yml

Example configuration:

web:
  host: postal.example.com

smtp_server:
  port: 25
  tls_enabled: true

dns:
  mx_records:
    - postal.example.com

Step 6 – Enable TLS (SSL Encryption)

Install Certbot:

apt install certbot -y

Generate a TLS certificate:

certbot certonly --standalone -d postal.example.com

Certificates will be stored in:

/etc/letsencrypt/live/postal.example.com/

Edit Postal configuration:

smtp_server:
  tls_enabled: true
  tls_certificate_path: /etc/letsencrypt/live/postal.example.com/fullchain.pem
  tls_private_key_path: /etc/letsencrypt/live/postal.example.com/privkey.pem

Step 7 – Initialize Postal

postal initialize

Create the administrator:

postal make-user

Step 8 – Start Postal

postal start

Step 9 – Configure Firewall

Open required ports:

ufw allow 25
ufw allow 465
ufw allow 587
ufw allow 80
ufw allow 443

Step 10 – Configure DNS Records

Correct DNS configuration is critical for email deliverability.

A Record

postal.example.com → YOUR_SERVER_IP

MX Record

example.com → postal.example.com (priority 10)

Reverse DNS (rDNS / PTR)

Your server IP must resolve back to your mail hostname:

YOUR_SERVER_IP → postal.example.com

This is usually configured through your VPS provider.

SPF Record

SPF specifies which servers can send emails for your domain.

v=spf1 ip4:YOUR_SERVER_IP ~all

DKIM Record

DKIM records are generated inside the Postal dashboard when adding a sending domain.

Example DKIM record:

postal._domainkey.example.com TXT
v=DKIM1; k=rsa; p=MIGfMA0GCSqG...

DMARC Record

DMARC helps receiving servers verify SPF and DKIM policies.

_dmarc.example.com TXT
v=DMARC1; p=none; rua=mailto:[email protected]

Step 11 – Access the Postal Dashboard

Open your browser:

https://postal.example.com

Login using the administrator account.

Step 12 – Create a Mail Server

Inside Postal:

  1. Create Organization
  2. Create Mail Server
  3. Add Sending Domain
  4. Generate SMTP credentials

SMTP Example Configuration

SMTP Host: postal.example.com
SMTP Port: 587
Encryption: TLS
Username: your_smtp_username
Password: your_smtp_password

Important Deliverability Tips

  • Always configure SPF, DKIM and DMARC
  • Use dedicated sending IPs
  • Warm up new IP addresses gradually
  • Monitor bounce and complaint rates

Conclusion

Postal allows you to run your own fully controlled SMTP infrastructure. With proper DNS configuration and TLS encryption you can achieve reliable email delivery and full control over your sending reputation.

Was this article helpful?

Share this article