I am using both Exim and Office 365 to send email - the server sends automated mails from an application using Exim and Office 365 handles day to day user and incoming email etc.

I am getting some mail from the server (i.e. from Exim) rejected due to "mx record not found" - there is an MX record but I suspect the issue is it points to Office 365 hence it is seen to be invalid when doing a lookup on the server.

Here is the bounce I get:

    SMTP error from remote mail server after RCPT TO:<123@abc.com>:
    host mail.host.com []: 554 5.1.8 <apache@web01.domain.com>:
    Sender address rejected: MX record not found

------ This is a copy of the message, including all the headers. ------

Return-path: <apache@web01.domain.com>
Received: from apache by web01.domain.com with local (Exim 4.72)
    (envelope-from <apache@web01.domain.com>)
    id 1WYYsD-0004AX-QJ
    for 123@abc.com; Fri, 11 Apr 2014 10:39:53 +0000
Date: Fri, 11 Apr 2014 10:39:53 +0000
Message-Id: <E1WYYsD-0004AX-QJ@web01.domain.com>
To: 123@abc.com
Subject: Password reset
X-PHP-Originating-Script: 501:password-forgotten.php
From: application@domain.com

Here are my A and MX records:

domain.com  0   3600    A
www.domain.com  0   3600    A
web01.domain.com    0   3600    A

domain.com  0   3600    MX   domain-com.mail.protection.outlook.com

Mail from the server comes from web01.domain.com so can I add another MX record to point web01.domain.com to domain.com for example? How can I fix this whilst continuing to use two mail "providers"?


  • Why not create a subdomain for web01, and put in the exim server address as MX? – NickW Apr 11 '14 at 11:27
  • It says that the sender address was rejected, not the sender server. So it the sender address really application@domain.com? or is it this.address@does.not.exist.com ? – MichelZ Apr 11 '14 at 12:46
  • This is where I am confused - application@domain.com does exist and is a proper mailbox etc but it is in Office365 whereas the mail is sent from domain.com via Exim, I think that is the problem? – bhttoan Apr 11 '14 at 12:49

This looks like you are getting blocked by the spam avoidance rules on an upstream server. These are some of the email policies I apply on my server. Requiring an MX record for the sending host is extreme, but in the fight again spam some sites find it appropriate. For legitimate sending domains don't have an MX record and rely on their A record.

Check to see if you have your rewrite rules configured properly. The sending address should probably be apache@example.com or donotreply@example.com not apache@web01.example.com. If you want replies, use an appropriate Reply-to address

The sending program should be configured to set the appropriate sender, in which case the rewrite rules shouldn't be required.


I know this is probably coming too late, but...

You might have to create or update the SPF record, in order for your main MX to accept sending from other hosts than itself.
Check out this Microsoft wizard for drafting an SPF: http://www.microsoft.com/mscorp/safety/content/technologies/senderid/wizard/

Alternatively, you can totally add a second MX which can point to any IP, including one in your A records.

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.