This doesn't work:
$to = 'myemail@gmail.com';
$from = 'test@test.com';
$subj = 'test';
$message = 'hello';
$headers = "From: {$from}
" .
"Reply-To: {$from}
";
"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}
" .
"Reply-To: {$from}
";
"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:
test.com. 7200 IN TXT "v=spf1 ~all"
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. :)
test2.com is not a valid domain name.MTA probably refuse to relay your message because of that.
If you turn on error_reporting, are you receive any warning?