Sending Emails to External Mail Server, Getting Caught Locally

Posted on 2011-10-08
Medium Priority
Last Modified: 2012-05-12

Over the last few days I have spent trying to find an asnwer to my problem. I recently redirected the MX record of a customers email to a new email server, seperate from the server where the domain is, that worked, email sent from say gmail, or hotmail is delivered.

The problem occurs when I try to send email from

a. a domain on the same server where the site is
b. from the website in code

obviosuly those are being delivered locally onto the server, so I went into the DNS settings and changed the mail point to the ip of the external mail server and the MX re3cord to mail.domain.com and then done an nslookup to confirm it was correct - but the mail still goers locally and im running out of time to get it resolved, any help would be much appreciatted.

Kind Regards
Question by:totesisotoner
  • 2
  • 2
LVL 76

Expert Comment

by:Alan Hardisty
ID: 36937349
Check your Recipient Policies for the domain that is now external and remove the domain name from the Policy - this will tell Exchange to deliver mail externally, not internally.

Expert Comment

ID: 36937365
The problem lies with your code on the server where the "website" is.

Let's say that your domain is example.com.  Your site is on the server example.com (@, and the MX records for mail.com are pointed to

When mail is being sent from the site (@, the code is checking the DNS server for the 'A' record of example.com which is returned as and mail is sent locally.  The code should be checking the DNS server for the 'MX' record of example.com which would be returned as and the mail would go properly.

A couple of ways to fix this:

1.  Set the 'A' record for mail.example.com to and send the mails to user@mail.example.com (instead of user@example.com).
2.  If there are only a few users, then do the mail forwarding from user@example.com to user@mail.example.com - this will vary depending on the mail server you are using.


Author Comment

ID: 36937868

on the first comment I'm afraid I'm
not using exchange. I'm using what's called Matrix Mail on a Fasthosts server.

On the second I'm afraid, yes that may work using the name@mail.domain.com but it isn't just sending from the site. If I send from domain2.com on the same server it routes locally too.

Any other ideas, sorry.
LVL 76

Accepted Solution

Alan Hardisty earned 2000 total points
ID: 36938033
Same principal applies - the server thinks the domain is hosted locally, so references to it need to be removed from the server.

How you go about that is anyone's guess.  I would talk to Fasthosts and ask their support team as they should be able to help you.

Author Comment

ID: 36938255
In a sense it is as the is hosted, but email isn't. Iv got round it now by deleting the domain and aliasing it onto another which as cleared the DNS

Many thanks for your help guys

Featured Post

 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the most often confused topics in the area DNS is the idea of GLUE records. Specifically, what they are, when they are needed, when they are provided, and how they are created. First, WHAT IS GLUE? To understand GLUE, you must first under…
Occasionally you run into the website or two that will not resolve properly using your own DNS servers.  Some people simply set up global forwarders for their DNS server.  I don’t recommend doing this because it can cause problems resolving addresse…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question