Need to migrate your e-mails to a new server? Free and paid versions of our online tool available.
Hero Image

Configure OpenSMTPD on Ubuntu 24.04

Configure OpenSMTPD on Ubuntu 24.04

Install

# OpenBSD – built-in:
rcctl enable smtpd && rcctl start smtpd

# Other platforms:
# Ubuntu/Debian:
apt install opensmtpd
# AlmaLinux/RHEL:
dnf install opensmtpd
# Arch:
pacman -S opensmtpd

Basic /etc/mail/smtpd.conf

pki mail.example.com cert "/etc/ssl/mail.example.com.crt"
pki mail.example.com key  "/etc/ssl/private/mail.example.com.key"

table aliases file:/etc/mail/aliases

listen on all tls pki mail.example.com
listen on all port submission tls-require pki mail.example.com auth

action "local"   mbox alias <aliases>
action "relay"   relay

match for local  action "local"
match from local for any action "relay"

Check and restart

smtpd -n
rcctl restart smtpd 2>/dev/null || systemctl restart opensmtpd

Send a test

echo "Subject: test" | sendmail [email protected]