xegr...@gmail.com wrote: > Hi. In a new install of Postfix 3.4.7-0+deb10u1 on Debian buster, I > would like Postfix to append $myhostname instead of $myorigin to > local mail with a From header containing just a username, like cron > or fail2ban emails. This server is listed in mx records for > example.com.
I see you are using Gmail. One must be careful and look at the "Show original message" in order to see what is actually being set on headers as Gmail does not display that information to you otherwise. For example if a comment is included then Gmail will display the comment and hide the address. Cron emails look like this for me: From: CronDaemon <r...@anxiety.proulx.com> To: r...@anxiety.proulx.com In Gmail that would display the "CronDaemon" comment and the root@ address part would be hidden. One must use Show original message with Gmail in order to see the actual contents of the header. If you want a specific From: then either set $myorigin to the domain you wish, or do not set myorigin and let it use $myhostname which is the default. http://www.postfix.org/postconf.5.html#myorigin > In older Postfix installations (3.1) it seemed that only setting the > below would be enough for local mail to be addressed from, for > example, r...@mx.example.com. Wondering what I am missing or what > to check next. Are you thinking of "masquerade_exceptions = root" with "masquerade_domains = example.com" here? That would match the description as you have written. > myhostname = mx.example.com > myorigin = example.com > mydestination = mx.example.com, localhost The above will make usern...@example.com be the From: address for locally created email. But the system will not accept mail for that domain since it does not appear in mydestination. I think mydestination should include $myhostname here. Meanwhile, I always have localhost.$mydomain in my list too. mydestination = $myhostname, localhost.$mydomain, localhost > /etc/mailname is mx.example.com Debian has a downstream patch that allows "myorigin = /etc/mailname" and the actual contents in that file in order to facilitate a generic image being customized across several different MTA installations all uniformly the same way. The contents of /etc/mailname are only used if also using the Debian patch functionality myorigin = /etc/mailname AFAIK. In the above you are not setting it to /etc/mailname and therefore that file's contents are not used. > postconf -n output https://pastebin.com/WwVdT8CF I see: append_dot_mydomain = yes Not sure if this plays into what you are asking. The default is yes. But previously you might have had it set to no. http://www.postfix.org/COMPATIBILITY_README.html http://www.postfix.org/postconf.5.html#append_dot_mydomain > If I remove $myorigin than all mail ends up going to @mx.example.com and > bounces. Why is it bouncing? And isn't mail going to @mx.example.com exactly what you have asked for? Why does that mail bounce? Bob