Michael
Michael

Reputation: 1328

PHP mail() function not working properly

I use PHP mail() function to send emails from my website. No problems with addresses, headers etc... The function actually sends emails, but it seems that they can't reach some specific addresses.

Examples:

  1. mail from [email protected] to [email protected],[email protected] - received on x, not received on y
  2. mail from [email protected] to [email protected],[email protected] - received on x, not received on y
  3. mail from [email protected] to [email protected],[email protected] - received on x, not received on y
  4. mail from [email protected] to [email protected],[email protected] - received on x, not received on y

why is this happening?

Upvotes: 0

Views: 373

Answers (1)

andrewsi
andrewsi

Reputation: 10732

If you're sending mail, and it's being received by one person but not another, the problem is almost always due to an issue at the receiver's end.

I'd say that your email is most likely getting stuck in a spam filter somewhere. An email sent through PHP tends to look very like email that's been sent by a spammer - you've got a From: header that doesn't match the server that sent it, and it's been sent to multiple people. Do you also have a Reply-to: header set, too?

If you use your code to send as basic an email as you can, see if that gets through to y; then you can start adding in the extra headers until you get to the point that it stops working again....

Upvotes: 1

Related Questions