how to always check mx records, no internal mailing

remco1

Verified User
Joined
Sep 3, 2011
Messages
10
Direct admin, Centos 7.
I hope you can help me, I have problem with internal mail delivery

Domain A moved his email to MS365 (everything works good, disabled setting 'use this server for outgoing mail' etc)
Domain B (also on this server) emails domain A via VPS.

The VPS tries to deliver the mail into the internal mailbox, and does not look at MX settings of domain A
Also the next stop in the deliveryrouting, the external transip mailrelais of my hosting partner, will not be used, because email delivery is already tried internal.

All users on this server, that uses the my vps as smtp, can't mail to domain A anymore....
How can I config the outging mail always check the MX for desired routing?
 

remco1

Verified User
Joined
Sep 3, 2011
Messages
10
Thank you for your suggestion. This is unchecked and this setting works for domain A.
For example, if a form is submitted on domain A, the mail is delivered to the external 365 account. great

But my problem is:... if domain B sends an email via his mail.domainB.com (local exim) the mail want's to be delivered locally, not to the 365 account. (mx setting is ingored)
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,932
Location
GMT +7.00
The domain which uses Office 356 should have the option [_] "Local Mail Server" unchecked

The link you posted is about sending all emails from all domains via external mail service. Is that what you need?
 

remco1

Verified User
Joined
Sep 3, 2011
Messages
10
My link about external smpt would solve the problem, because the exim will not deliver the mail locally. But it is not a really good / beautifull solution
Websites of Domain A and domain B are on the same VPS / IP

The option [_] "Local Mail Server is " unchecked for domain A. And that works great for domain A. if a form is posted on www.domainA, it will be send to 365.

But when domainB sends an email via outlook via smtp.domainB.com (same webserver IP) to domain A, the uncheck 'Local Mail Server' setting becomes useless, because exim tries to drop the mail locally.
How can we config exim that it will respect this setting

As long as I use DA (for 10 years+), if have this problem.....
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,932
Location
GMT +7.00
As soon as the option [_] "Local Mail Server is " unchecked, all deliveries from local domains will be done to the domain's MX record. That's true for a default exim.conf of any actual version. If it does not work this way on your server, then exim.conf might be either too old or too much customized.
 

remco1

Verified User
Joined
Sep 3, 2011
Messages
10
Yes you would expect that, but this is really not the case.... Please test it yourself, or if you need logs, or if you want to try yourself let me know ..

I have several VPS/DA setups. All updated to to latest exim version (also because of the recent vulnerability)...
As long as I can remember i have this problem, when my customer use an exernal mailserver, while I email via same vps like mail.mydomain.com.

My old solution was to mail with the smtp of my internetprovider, and taking an external routing to look at the MX, but with modern mailing challenges this is not a solution anymore....

When I mail with local@samevps.com to not-exist@domainA.com i get from my server the message back 550 "Unknown User"
When I mail with external@othervps.com to not-exist@domainA.com i get also 550 message, but this time from 'prod.protection.outlook.com'
 
Last edited:

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,932
Location
GMT +7.00
Give me an example of two domains here or via PM: first one with local MX and another with a remote MX.
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,932
Location
GMT +7.00
When you connect to your server and send emails to a domain which mail is handled by Office 356, it is still your VPS which will report any delivery issues if a remote MX server refused to accept emails for further delivery. So I believe it is normal to get an error Serverfout: 550 "Unknown User" from your own VPS here.

Check /var/log/exim/mainlog for more details, I expect that you will see something similar to

Code:
 Recipient address rejected: Access denied [VE1EUR01FT036.eop-EUR01.prod.protection.outlook.com]
an check once again:

Code:
grep [B]domain.com[/B] /etc/virtual/domain*
for your domain with MX at Office 356.
 
Top