Setting a domain as primary for the mailer daemon in postfix/dovecot

daemondovecotemailemail-serverpostfix

I currently have two domains set on my server on two different IPs. One is set on the domain's primary IP, and the second on a failover IP. Let's say I have domain1.com and domain2.com

Currently, the mailer daemon delivers from MAILER-DAEMON@domain2.com, originally, postfix was setup with domain2. I would like it to send from domain1 instead. I have no idea what makes postfix select domain2 over domain1.

I've seen Rename mailer-daemon in postfix on the issue, but I don't want to "rename" mailer-daemon, I want to change the domain mailer-daemon is using by default.

Best Answer

You probably have your original domain in $mydomain, so change that.

From the Postfix Basic Configuration:

What domain name to use in outbound mail

The myorigin parameter specifies the domain that appears in mail that is posted on this machine. The default is to use the local machine name, $myhostname, which defaults to the name of the machine. Unless you are running a really small site, you probably want to change that into $mydomain, which defaults to the parent domain of the machine name.

For the sake of consistency between sender and recipient addresses, myorigin also specifies the domain name that is appended to an unqualified recipient address.

Examples (specify only one of the following):

/etc/postfix/main.cf:

myorigin = $myhostname (default: send mail as "user@$myhostname")
myorigin = $mydomain   (probably desirable: "user@$mydomain")
Related Topic