Link to home
Create AccountLog in
Avatar of totesisotoner
totesisotoner

asked on

Sending Emails to External Mail Server, Getting Caught Locally

Hi,

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
Karl
Avatar of Alan Hardisty
Alan Hardisty
Flag of United Kingdom of Great Britain and Northern Ireland image

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.
Avatar of sshah254
sshah254

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 (@1.1.1.1), and the MX records for mail.com are pointed to 2.2.2.2.

When mail is being sent from the site (@1.1.1.1), the code is checking the DNS server for the 'A' record of example.com which is returned as 1.1.1.1 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 2.2.2.2 and the mail would go properly.

A couple of ways to fix this:

1.  Set the 'A' record for mail.example.com to 2.2.2.2 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.

SS
Avatar of totesisotoner

ASKER

Hi,

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.
ASKER CERTIFIED SOLUTION
Avatar of Alan Hardisty
Alan Hardisty
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
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