I recently built a mail server with Postal and had a better experience than I expected, so I can’t wait to share my experience.

Why build a mail server

Sending emails is a common requirement for web services, such as account verification, password reset and so on. Generally it is recommended to use a third-party mail service, as self-built mail servers are not reputable enough to be easily judged as spam.

However, there are some problems with third-party services.

  • Expensive. If you only send transactional emails then the expense is not high, while the price cannot be ignored when you want to do mailing lists and other functions with high sending volume.
  • Shared reputation. The mail servers of third-party services are in a pool of IPs, and the delivery rate can be affected by other users.

If you are going to do mail sending volume applications and want to maintain the reputation of the mail server by yourself, building your own mail server is necessary.

Postal Introduction

Postal is a full-featured, open source mail server. It includes the following features.

  • Support for multiple organizations, servers, and authorized users.
  • Support for sending and receiving mail.
  • Support for webhook.
  • Full sending log.
  • Spam filtering.
  • more ……

You can say that it offers almost everything that third-party mail delivery services offer. Just like Mailgun and Postmark, which are hosted by themselves.

Another advantage of Postal for me is that it is developed in Ruby & Rails, so it is easier to hack.

Installation Instructions

Postal has very detailed installation documentation, so I won’t go into much detail.

One thing to note is that the prerequisite for building a mail server is to find a server provider that allows mail servers to be built. The most heavily used AWS, GCloud, Aliyun, etc. do not allow building mail servers. The smaller Linode and DigitalOcean restrict new users from building, but you can apply for opening through work orders. So before you install it, check if your server provider allows you to build mail servers (without blocking port 25 outbound).

The second problem you may encounter is the IP. Some IPs have been used by spammers and have been blacklisted, which may be rejected by other mail providers directly. Therefore, you can’t choose a server provider that has no restrictions on email delivery either.

If you can solve the above two problems, you can set up mail server smoothly according to the official documentation.

Usage tips

Testing spam match

After installation, use Mail Tester to test the spam match.

In Mail Server -> Message -> Send Message page, you can send test emails.

test emails

Resolve the issues listed by Mail Tester to the extent possible.

Distinguish between organizations and servers

Postal supports multiple organizations and multiple servers under them, using this feature you can distinguish between multiple applications and multiple environments.

Distinguish between organizations and servers

Setting up inbound routing

Inbound routes can be used to develop features such as email comment replies and to forward customer service emails.

Setting up inbound routing

Setting sending limits

Each mail server can set individual sending limits. You can set a limit according to the application’s sending volume to avoid program error or machine abuse to send out a large amount of spam, which will affect the mail server’s reputation.

Setting sending limits

Summary

Building a mail server is a start, whether the mail can be delivered is the key. At present, the sending volume of my application is very small and not representative, I hope to share more data and experience in the future when I have the chance.

Overall, the powerful features of Postal exceeded my expectation, and I highly recommend it for building mail server.