This doesn’t work:
$to = 'myemail@gmail.com';
$from = 'test@test.com';
$subj = 'test';
$message = 'hello';
$headers = "From: {$from}\r\n" .
"Reply-To: {$from}\r\n";
"X-Mailer: PHP/" . phpversion();
$response['success'] = mail($to, $subj, $message, $headers);
This does:
$to = 'myemail@gmail.com';
$from = 'bill@gates.com';
$subj = 'test';
$message = 'hello';
$headers = "From: {$from}\r\n" .
"Reply-To: {$from}\r\n";
"X-Mailer: PHP/" . phpversion();
$response['success'] = mail($to, $subj, $message, $headers);
The mail function doesn’t seem to work with test@test.com, is there a reason for this ?
Thank you
Probably because test.com has an SPF record which indicates that it doesn’t send email:
This would likely lead GMail to reject (or flag as spam) any mail claiming to be from test.com.
Alternatively, GMail may have an explicit block on test@test.com. 🙂