How to Setup Postal Mail Server on Ubuntu 18.04
In todayโs digital age, email communication is an essentialย
part of any business operation. Email marketing is one of the mostย
effective ways to reach a large audience and increase brand awareness.ย
One critical component of an effective email marketingย
strategy is a reliable SMTP server. In this article, we willย
guide you through the process of building your own postal SMTP server,ย
step by step.
Table of Contents
What is a Postal SMTP Server?
Before getting into the specifics of creating your own SMTP server, letโs first define it and examine its operation. The standard system for transferring emails between servers on the internet is called SMTP, or Simple Mail Transfer system. It is the Work of an SMTP server to transmit and receive emails. Open-source email server software called Postal offers an SMTP and IMAP server that is quick and scalable for email sending and receiving.
Why Build Your Own SMTP Server?
Building your own SMTP server has several advantages over utilizing a third party service.ย ย ย ย ย ย ย ย ย ย the fact that you have complete controlย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย over yourย email infrastructure means that you may customize it to suit your unique business requirements.By preserving your IP reputation, you may also save money on email service expenses and guarantee improved email delivery.
Prerequisites for Building a Postal SMTP Server
Before we start building our postal SMTP server, there are a few things we need to have in place:
- A server or virtual machine (VM) running a Linux operating system
- A public IP address for your server
- A domain name for your email server
- Basic knowledge of Linux command-line interface (CLI)
Installing Postal SMTP Server
Now that we have all the prerequisites in place letโs start building our postal SMTP server.
Step 1: Install Dependencies
Before we install Postal, we need to install its dependencies. Postal requires Node.js, Redis, and PostgreSQL. Hereโs how you can install them:
Name Type Value
@ A 1.2.3.4
mail A 1.2.3.4
rp.mail A 1.2.3.4
track.mail A 1.2.3.4
psrp.mail Cname rp.mail.yoursite.com
mail MX mail.yoursite.com ; 10
routes.mail MX mail.yoursite.com ; 10
rp.mail MX mail.yoursite.com ; 10
mail TXT v=spf1 a mx include:spf.mail.yoursite.com ~all
rp.mail TXT v=spf1 a mx include:spf.mail.yoursite.com ~all
spf.mail TXT v=spf1 ip4:1.2.3.4 ~all
_dmarc.mail TXT v=DMARC1; p=none; fo=1; rua=mailto:info@yourdomain.com; ruf=mailto:info@yourdomain.com
First of all switch to root user
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Then
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo curl -SL https://github.com/docker/compose/releases/download/v2.13.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
apt install git
apt install git curl jq
git clone https://postalserver.io/start/install /opt/postal/install
sudo ln -s /opt/postal/install/bin/postal /usr/bin/postal
Install MariaDB
docker run -d \
--name postal-mariadb \
-p 127.0.0.1:3306:3306 \
--restart always \
-e MARIADB_DATABASE=postal \
-e MARIADB_ROOT_PASSWORD=postal \
mariadb
docker run -d \
--name postal-rabbitmq \
-p 127.0.0.1:5672:5672 \
--restart always \
-e RABBITMQ_DEFAULT_USER=postal \
-e RABBITMQ_DEFAULT_PASS=postal \
-e RABBITMQ_DEFAULT_VHOST=postal \
rabbitmq:3.8
Configuration
postal bootstrap postal.yourdomain.com
nano /opt/postal/config/postal.yml
Now to edit postal.yml run the following command
# The host that the management interface will be available on
host: mail.edabosang.com
# The protocol that requests to the management interface should happen on
protocol: https
web_server:
# Specify configuration for the Postal web server
bind_address: 172.105.33.83
port: 5000
smtp_server:
# Specify configuration to the Postal SMTP server
port: 25
logging:
# Specify options for the logging
stdout: true
main_db:
# Specify the connection details for your MySQL database
host: 127.0.0.1
username: root
password: postalpassword
database: postal
message_db:
# Specify the connection details for your MySQL server that will be house the
# message databases for mail servers.
host: 127.0.0.1
username: root
password: postalpassword
prefix: postal
rabbitmq:
# Specify connection details for your RabbitMQ server
host: 127.0.0.1
username: postal
password: password
vhost: postalvhost
dns:
# Specify the DNS records that you have configured. Refer to the documentation at
# https://github.com/atech/postal/wiki/Domains-&-DNS-Configuration for further
# information about these.
mx_records:
- mail.edabosang.com
smtp_server_hostname: mail.edabosang.com
spf_include: spf.mail.edabosang.com
return_path: rp.edabosang.com
route_domain: routes.mail.edabosang.com
track_domain: track.mail.edabosang.com
smtp:
# Specify an SMTP server that can be used to send messages from the Postal management
# system to users. You can configure this to use a Postal mail server once the
# your installation has been set up.
host: 127.0.0.1
port: 2525
username: # Complete when Postal is running and you can
password: # generate the credentials within the interface.
from_name: Postal
from_address: postal@edabosang.com
rails:
# This is generated automatically by the config initialization. It should be a random
# string unique to your installation.
secret_key: b73a7e04571431c601d19a7688418eb395d059c1ada525dcfd337e978236be759e278367fb7c6773be625265d3d235ee98b4f8405957e4
postal initialize
postal initialize
postal make-user
postal start
postal start
Install Caddy
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
postal upgrade
Enjoy
FAQs
What is Postal SMTP server ?
Boost Email Delivery with Postal SMTP
Send bulk emails reliably and efficiently with Postal SMTP server. Improve deliverability, gain insights with analytics, and customize configurations for optimal performance.
Ineed make warm-up ?
Effective Warm-Up for Email Sending
To warm up your email sending, start with a small engaged batch of recipients. Gradually increase volume while monitoring metrics closely. Maintain engagement and adapt based on feedback to establish a positive sender reputation and improve deliverability.