Search code examples
phpemailspf

Sending emails with PHP fails


Situation: Our client (owner of domain.com) has set the A record for www.domain.com to the IP address of one of our servers where we run the website behind domain.com. We only provide hosting for this domain, they have their own email servers.

This means that domain.com has another IP than the mail server for domain.com.

Problem: Sending mails from PHP to [email protected] works BUT sending mails to *@domain.com does not work.

Question: Does this has something to do with SPF records? How do I solve this?

thx

Bundy


Solution

  • This happened to me on a shared host as well as is probably because there is a local delivery mechanism in place on the web server, i.e. when your web server sees an email for @domain.com it assumes it will be the one to handle, and does not pass in on to the actual mail server.

    Go into your web server's panel (Cpanel or whatever) and check your email settings for this domain. Make sure "local delivery" or something similar is disabled for domain.com