Problem with mailform when dns/email is located externally

torkil

Member
Sep 12, 2006
5
0
151
The situation:
We host a website for a client, clientname.com, but another company has the DNS and their e-mail accounts. No problem: The other company just sets their A-record to point to our webserver. Now we have set up a standard contact mailform on the clients website, using php's mail function to let the clients visitors send e-mails to the client.

Problem: No e-mails ever arrive!
Background for problem: The cPanel account is automatically created with MX record being clientname.com, when the MX record should really read mail.othercompany.com since they are the ones hosting the e-mail. So our webserver is in fact trying to send mail to itself, where there are no email accounts set up.

Half-a-solution:
I insert the correct MX record for clientname.com in our cPanel. But this leaves us with...:

New problem: What if the other company that hosts the domain and the email decides to change the MX record? We would never know about it, and emails would get stopped again.

So can anyone give me a suggestion for a more permanent solution to this problem? It would really make my day...
 
Last edited:

ujr

Well-Known Member
Mar 19, 2004
290
0
166
well, that is somewhat out of your control, however, you could test that the mailserver exists and that you can connect to it BEFORE you send your email. If it fails, just make it send you a an email stating that it's unreachable.

Other than that, the MX handler would need to be changed for the domain if the mailserver changes.
 

torkil

Member
Sep 12, 2006
5
0
151
Thanks for your response!

So you basically think my best option would be to try to convince the client to host his DNS with us, so we have control of the MX record?

... or is there a "disable MX-automation" or something like that in the account setups anywhere?
 

ujr

Well-Known Member
Mar 19, 2004
290
0
166
Ideally, for control, yes... but there may be other reasons why a client may want to point their MX records to some other server.

Anyway, why must the email be sent through the remote SMTP server anyway? Couldn't your form simply use php mail?
 

torkil

Member
Sep 12, 2006
5
0
151
This happens with the php mailer too, I've spotted the problem in all the following applications:

- Regular contact form, using php's mail() function
- E-mails going out of our webbased CRM solution, using sendmail
- E-mails going out of our customer's mailing list, probably using php's mail() function too