I have a website, example.com, running on a Windows 2008 server with IIS 7 and the "IIS 6" SMTP service. The website regularly sends out emails to email@example.com.
In rare instances, the MX record lookup for example.com fails, and so the SMTP service falls back to the A record, which I understand is expected behavior. However, this is not desired behavior, since the mail server for example.com is on a different machine, so the occasional email bounces.
What's the best way to prevent this?
EDIT: My DNS setup looks like this:
A - example.com -> 22.214.171.124 A - mail.example.com -> 126.96.36.199 CNAME - www.example.com -> example.com MX - example.com -> server-a.outside-spam-filter-service.com MX - example.com -> server-b.outside-spam-filter-service.com MX - example.com -> server-c.outside-spam-filter-service.com MX - example.com -> server-d.outside-spam-filter-service.com
I am not running a DNS server on the local machine. The machine is set to use DNS servers of our hosting provier (PEER1).
EDIT 2, answers to troubleshooting questions:
1. Is the web server part of an AD domain?
The server is not a part of a domain.
2. Is the smtp service on the web server configured to accept email for example.com? If it is, and is not configured to relay email, it will try to deliver the message locally, as opposed to looking for the MX records, which could be confused with falling back to the 'A'.
The SMTP service is configured to accept all local SMTP connections, and is configured to relay all emails. (Plus, if it wasn't configured to relay, wouldn't it bounce all emails as opposed to just some?)
3. ... Check the dns servers that the web server is using, and from the web server run the queries to check the mx records for example.com, and make sure it is returning the the correct info ....
I did a command-line nslookup using both servers listed as the DNS servers for the primary NIC. The MX records came back as expected.