0

I have a server which has the name server1.mydomain.com This server is used mainly as web server and as mail server for several domains.

But it is NOT the mail server for mydomain.com. The mail server for mydomain.com is mail.mydomain.com.

Sending mails to various external email addresses is working fine. All the mails are delivered correctly. All the client domains hosted on this systems can both send and receive mails correctly.

But unfortunately, I have an issue when sending mails to [email protected]. It seems as if Postfix does not check who the responsible mail server for mydomain.com might be. Instead it expects itself to be the correct mail server. As none of the users of mydomain.com are known to my server (it isn't the mail server of the domain after all), all the mails sent to [email protected] keep getting an error message saying: "Recipient address rejected: User unknown in virtual mailbox table" which is clear to me...

How can I pursuade postfix to deliver mails (addressed to anyone from mydomain.com) to mail server of mydomain.com instead of processing them itself? All the other mails should be processed as is...

Best regards, Tom

2 Answers 2

0

Add the mailserver as relayhost in your main.cf:

relayhost=mail.example.com 

All Mails will be routed through this server, this will also be an advantage regarding SPF and DKIM checks.

Also, remove your domain from mydestination if it is in there. Only localhost and the hostname should be in there.

3
  • I do not want to send all mails through a relay host. They should be sent by my server directly to the recipient's smtp server. Commented Sep 21, 2017 at 14:23
  • In that case the answer by Esa is better for you. However, IMHO it is better to have a single outgoing mailserver, it makes managing the mail infrastructure much simpler in the long run. Commented Sep 21, 2017 at 14:53
  • Basically, I agree. But in my scenario, the mail server is sending mails for many different domains and sending them all to a relay host would mean additional configuration work for the relay host as well... As it is quite difficult to re-configure the relay host in my scenario, I would prefer a solution without relay host. Commented Sep 21, 2017 at 15:39
0

If there, remove the domain from mydestination or virtual_alias_domains.

You don't necessarily need to set up relayhost as Gerald suggests, because the server will by default use DNS to get the MX records for correct MTAs. Setting relayhost=mail.example.com requires that mail.example.com permits relay from your server1.example.com. (Whichever is the outgoing MTA, you should also have it specified as a permitted sender in your SPF record.)

1
  • I don't have virtual_alias_domains defined in my setup. Changing mydestination did not work so far. I just restarted the service and expected the server to behave differently, but still the same error message is shown. Commented Sep 21, 2017 at 14:26

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.