Testing SMTP Sending with Postfix and MailHog on Docker

Testing SMTP on Docker(postfix+mailhog)

I had a situation where I wanted to send SMTP from inside a Docker container, so I gave it a try using mailhog.

I based this almost entirely on the article above (in Japanese)

What I changed

  • Changed the Dockerfile image to almalinux
    Because centos8 is past EOL and an error came up when fetching packages
  • Added privileged: true to docker-compose.yml
    It did start with cap-add as well, but errors were being emitted

Send test

  • Once it has finished starting up, check inside the Docker container whether postfix can send on port 25.
  • Since relayhost uses mailhog’s port 1025, it is not actually sent to the real destination, so there is nothing to worry about
  • On the host side you can send on port 1025 as is
# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 0d95f56f386c.example.com ESMTP Postfix
mail from: <[email protected]>
250 2.1.0 Ok
rcpt to: <[email protected]>
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
subject: mail testing
it is testing
.
250 2.0.0 Ok: queued as 367DF26008A

Leave the Docker container, access http://localhost:8025 in a browser on the host side, and if the mail has arrived you are done

Hardening a Docker Mail Server on Sakura VPS

Enabling SpamAssassin, ClamAV, Fail2ban, Postgrey and Let's Encrypt in docker-mailserver

This is a follow-up to Building a mail server with Sakura VPS + Docker + Freenom , in which I tighten up the security a little If the server from last time is running under docker, stop it Copy $ docker-compose down Closing imap and submission In the previous article I confirmed that imaps and smtps communication works, so I close imap and submission docker-compose.yml (only the changed parts are shown) [Read More]

Building a Docker Mail Server on a Sakura VPS with a Freenom Domain

MailServer(Postfix+Dovecot) on Docker by VPS

TL;DR I tried building a mail server with Docker on a Sakura VPS I will skip registering a domain on Freenom and how to use Cloudflare Linux(Debian10) Docker is assumed to be already installed A domain name has been obtained from Freenom and registered in a DNS such as Cloudflare Freenom : example.com (fictitious name) Sakura VPS: 11.22.33.44 (fictitious IP) For this server build I referred to the sites below [Read More]