Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does the PHP mail() function work if I don't own the MX record

Tags:

php

dns

I'm not sure I'm using all the correct terminology here so be forgiving.

I just put up a site with a contact form that sends an email using the PHP mail() function. Simple enough. However the live site doesn't actually send the email, the test site does. So it's not my code.

It's a shared host and we have another site that has the same function that works perfectly, so it's not the server.

The only difference between the two is that the site that doesn't work just has the name server pointing to us and so the MX record never touches our server.

So my question is, could some one please confirm that the mail() function wont work if we don't have the MX record pointing to our server. Thanks

like image 229
cole Avatar asked Sep 02 '08 01:09

cole


1 Answers

Yes. It will work just fine. I have a PHP script using the mail() function with the MX records set to Google Apps.

If the two scripts are on different hosts (it's a bit unclear from your post), then make sure that the host doesn't block some of the custom headers. I had issues with this when creating my script, but removing all but the From header fixed the problem.

like image 62
Dan Walker Avatar answered Oct 03 '22 03:10

Dan Walker