Introduction
Many applications need to send email (notifications, password resets, alerts) but don't need to receive mail. A send-only Postfix configuration is lightweight and straightforward.
Installation
sudo apt update
sudo apt install -y postfix mailutilsDuring installation, select Internet Site and enter your server's FQDN (e.g., server.example.com).
Configure Send-Only Mode
Edit /etc/postfix/main.cf:
myhostname = server.example.com
mydomain = example.com
myorigin = $mydomain
inet_interfaces = loopback-only
mydestination = $myhostname, localhost.$mydomain, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::1]/128Restart Postfix
sudo systemctl restart postfixTest Sending
echo "Test email body" | mail -s "Test Subject" user@example.comSet Up DNS Records
For deliverability, ensure you have:
- SPF record:
v=spf1 a mx ip4:YOUR_IP ~all - PTR record: reverse DNS matching your hostname
- A record: hostname pointing to your server IP
Viewing the Mail Queue
# Show queued messages
mailq
# Flush the queue
sudo postfix flush
# Delete all queued messages
sudo postsuper -d ALL