0

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 [email protected], 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.

2
  • you can try with @backupmx relayhost = primarymx this garantee that regardless which my you get Mail in it will always be sent from pmx, remind to setup the mx records that it will respobd like this
    – djdomi
    Aug 12, 2019 at 16:07
  • Possible duplicate of Configuring a Postfix backup server
    – djdomi
    Aug 12, 2019 at 16:10

3 Answers 3

1

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")
0

You need to have 2 proper lines in your main.cf file (/etc/postfix/main.cf):

  • mydomain = mydomain1.net (while mydomain1.net is your domain)

  • myorigin = $mydomain

The hostname part is usable for the MX part:

  • myhostname = mx.mydomain1.net (which will give you the hostname and )
  • myorigin = $myhostname
-1

If main.cf file has myorigin = /etc/mailname then $myorigin is set to the domain name in the file. To change the domain name just change the domain in the file.

1
  • As of this moment, this answer has a -2 vote. The original response above by CT Tang was a good candidate for a downvote. However, after editing by @jrsupplee I think this answer is valid. I actually did this before coming to this Q&A and it worked. (changed the domain in /etc/mailname). I was looking for a validation of the solution. So I'm upvoting this, hoping we can simply get it back to 0 or +1. Then the OP can decide if what to do about accepting an answer. Perhaps JR Supplee should post his revision as a new answer, leave CT Tang's as it was, and get the credit here? Whatevah.
    – TonyG
    Nov 20, 2020 at 0:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .