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.


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):


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

postfix has setup a file mailname in /etc directory that hard coded domain2.com. you need to change it to domain1.com in /etc/mailname and restart postfix

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.