On your stock email server you might see the following message repeatedly in the log file:
Aug 20 08:55:18 server-name postfix/trivial-rewrite[1652032]: warning: do not list domain server-name.example.com in BOTH mydestination and virtual_alias_domains
Update 18 December 2021
On another stock server we received this message. However, this time the message didn’t display once, but twice. Also emails were not forwarded to end destinations.
Upon examination of the mydestination
configuration directive in main.cf we were able to isolate the domain the was causing problems. We also resolved some ambiguity with regards to the hostname. Before the hostname was something like “example.co.za” but there was also a domain where email had to be delivered “example.co.za”. Note on the hostname that there is no host – just a domain. So our steps were:
- Rename the host from “example.domain2.com” to “cp”
- Update
mydestination
The conclusion is that the message might be harmless at times, but at other times it’s very important to actually address is. To finish off this update of the original article we paste the duplicate lines from the log file, and then a before and after of mydestination
Log file:
Dec 7 10:42:03 example postfix/trivial-rewrite[3850766]: warning: do not list domain example.domain2.com in BOTH mydestination and virtual_alias_domains Dec 7 10:42:03 example postfix/trivial-rewrite[3850766]: warning: do not list domain example.domain2.com in BOTH mydestination and virtual_alias_domains
mydestination
before and after
Before
#mydestination = $myhostname, example.domain2.com, localhost.co.za, , localhost, example.masterdomain
After
mydestination = $myhostname, cp, localhost.co.za, , localhost, example.masterdomain
Original Article
Research on this issue gives inconsistent results but the most important thing is although truly annoying, the warning is harmless and your email server will be functioning perfectly.
To get to the bottom of the error, the following information is useful:
# cat /etc/postfix/main.cf | egrep "mydestination|myhostname" ... myhostname = server-name.example.com mydestination = $myhostname, localhost.example.com, , localhost
One’s gut instinct and some posts insinuate remove $myhostname
from mydestination
. In our experience this will cause catastrophic failures in that every message will now bounce.
The other handy information that in spite of the message talking about virtual_alias_domains
it might instead be referring to a table called virtual
in /etc/postfix
instead.
Conclusion: On a shared Virtualmin server, rather just live with the message.
References
- https://serverfault.com/questions/491601/postfix-do-not-list-domain-example-com-in-both-mydestination-and-virtual-alias
- https://www.howtoforge.com/postfix-do-not-list-domain-example.com-in-both-mydestination-and-virtual_mailbox_domains
- http://www.postfix.org/virtual.5.html