PHP mail() not sending on GoDaddy domain with DNS hosted here


I have a domain,, registered with GoDaddy but the DNS is hosted with Cloudflare. I cannot send email to, for example, [email protected] from this domain from within a PHP script running on the server using shared hosting. The PHP function I am using is mail().

Is there specific documentation explaining how this all works and what needs to be done to effect it? I would like to learn something from this. Thank you

Any help will be appreciated.



Thank you for asking.

I am sorry to hear you are experiencing an issue with receiving/sending e-mails via your Website / PHP script while using Cloudflare services for your domain name.

Kindly, see below suggestions and tips for troubleshooting.

Usually, the MX record should point to a hostname such as mail , and the A (or CNAME ) type record for that hostname should be set to :grey: (DNS Only).

You might be using a hostname like for your PHP script, which is :orange: (proxied) rather than the unproxied :grey: (DNS-only) like (possible this one not existing or is :orange: instead of being :grey:) at the DNS tab of Cloudflare dashboard, in your e-mail client for sending/receiving server (MS Outlook, Mozilla Thunderbird, etc.)

Could you re-check and re-write your PHP script?

Otherwise, I am successfully doing it via PHPMailer script as far as it has a lot of more options, and I can even connect to my external e-mail server provider (defining hostname, port, SSL/TLS settings, credentials, etc.) and send e-mails using it, while the website / script is hosted on another server.

Nevertheless, you might have to troubleshoot if the port like 25/465/587 is open at your GoDaddy hosting and contact GoDaddy to check this for you.

May I suggest checking below article if your e-mail records (usually the A mail and the MX record) are configured properly while you are using Cloudflare for your domain name:

I see your e-mail records are properly configured so far:

;ANSWER 300 IN MX 0 300 IN MX 10

;ANSWER 300 IN A 300 IN A 300 IN A

I cannot find a DNS record for SPF/DKIM/DMARC.

Maybe you are missing some TXT/CNAME records (for SPF, DKIM, DMARC if so?)

I would also recommend looking into the below article due to further prevention of your e-mails being marked as a SPAM at the recipient’s side:

Nevertheless, using online tools on the links below you could test and troubleshoot more what is going on with your e-mails:

If you can, please check GoDaddy or your shared hosting server log files for any troubleshooting information.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.