What role does /etc/mailname play in postfix?

Solution 1:

You can (but you are in no way forced to) configure postfix to read that file. Debian-based systems ship configuration that does that. Search your configuration to see if yours is referencing the file:

# postconf | grep mailname
myorigin = /etc/mailname

You could just as well have put your verbatim domain name directly into main.cf instead of using the path to instruct postfix to read from there.

You can get the full and read about the individual effects list by searching for myorigin in man 5 postconf.

The most obvious place this is used in common setups is then the append_at_myorigin feature, where submitting mail not specifying a domain will have the domain - potentially read from that file - appended. Many other Postfix directly use or reference $myorigin.