Saturday, May 2, 2026¶
Today I have been playing during 2 hours with 7 postfix config parameters (myhostname, myorigin, mydestination, inet_protocols, inet_interfaces, local_transport and smtp_bind_address) on two servers (kuu and lumi). There were moments when I didn’t understand the world and had the feeling that some hidden random error generator is running somewhere…
It seems that the article How to Configure Postfix as a Send-Only SMTP Server on IPv4 is not what we want. A default postfix config is good for us, I just need to set three parameters correctly: myhostname, mydestination and myorigin.
TIL:
postconf key1 key2shows the current settings, one linekey=valuefor each specified key.postconf key=valueupdates themain.cffile from the command line. This is useful when playing around. You can specify multiple key=value pairs. A value can be empty. Know your bash rules.systemctl restartis more thansystemctl reload. When you change inet_interfaces or inet_protocols, reloading won’t do it and postfix even issues a warning… but only in the system journal, not on the command line.Saying “echo foo | mail -s test root” is not enough. It’s important to specify
-r(or--return-address)becausemaildoes not consult/etc/mailname, it will just say username@hostname, and hostname is just our nickname, and most mail servers refuse emails with a non-existing domain name in theFromfield. Here is a generic command-line for sending a test email:$ echo foo | mail -r `whoami`@`cat /etc/mailname` -s test root
(I wonder whether it would be better to set hostname to the the full public name. I set it to the nickname only because I don’t want to see the full public name in the prompt.)
In Postfix you can say “/etc/mailname” as the value for myorigin, but not for myhostname. Seems that Postfix checks for a “/” at the beginning only for myorigin. Don’t ask me why.
Here is my recipe for configuring:
# postconf myhostname=`cat /etc/mailname`
# postconf myorigin=/etc/mailname
# postconf 'mydestination=$myhostname,localhost'
# systemctl restart postfix
To verify these three parameters:
# postconf myhostname mydestination myorigin
myhostname = lumi.mylino.net
mydestination = $myhostname,localhost
myorigin = /etc/mailname