PHP mail() function will not send to gmail but will send to my non-gmail account

It turns out that Google blocked my server because another site on the same server was hacked and used for spam.

To test and ensure that it was a problem with the server, I created a simple PHP file that would send an email to my email address on page refresh. It worked when I sent to my exchange-based email address, but not to any Google-related accounts.

Code:

$headers = 'From: <[email protected]>' . "\r\n" .
'Reply-To: <[email protected]>';

mail('<[email protected]>', 'the subject', 'the message', $headers,
  '[email protected]');
?>

Thanks for the help all.


Try putting <> around the From and Reply to addresses. I had that same problem with work emails.

Tags:

Php

Email