Sending Emails to External Mail Server, Getting Caught Locally


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 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
Who is Participating?
Alan HardistyConnect With a Mentor Co-OwnerCommented:
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.
Alan HardistyCo-OwnerCommented:
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.
The problem lies with your code on the server where the "website" is.

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

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

A couple of ways to fix this:

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

totesisotonerAuthor Commented:

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 but it isn't just sending from the site. If I send from on the same server it routes locally too.

Any other ideas, sorry.
totesisotonerAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.