Set Up SMTP and IMAP Proxy with HAProxy (Debian, Ubuntu, CentOS)

LinuxBabe
2 min readMar 22, 2020

--

In previous tutorials, we discussed how to set up a mail server from scratch on Linux (Ubuntu version, CentOS/RHEL version), and how to use iRedMail or Modoboa to quickly set up your own mail server without having to manually configure each component of the mail server stack. This tutorial is going to show you how to set up SMTP and IMAP proxy for your mail server with HAProxy.

When Do You Need SMTP and IMAP Proxy?

Some folks run email servers at home, but may have the following problems:

  • Port 25 is blocked.
  • They don’t have a static IP address.
  • They can’t create PTR record.

If port 25 is blocked, you can’t send emails directly to recipients. And if you don’t have static IP address or PTR record, your emails are likely to be rejected or land into the spam folder. If you are in this situation, you can run a VPS (Virtual Private Server) at a data center and use it as a proxy for your mail server. The VPS has a static IP address and you can create PTR record for the IP address. Other email servers would think that the VPS runs your mail service and when you send an email, they would think the email comes from your VPS.

--

--

No responses yet