I am trying to send an email using PHP from a free hosting account on Hostinger (hostinger.co.uk).
Here is my code:
<?php
if(isset($_POST['submit'])){
$to = 'xxxxxxxxx@gmail.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: customer@novel.com' . "\r\n" .
'Reply-To: customer@novel.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
}
?>
For some reason when i send the email, it doesn't come through to my gmail account. It's not even in spam.
I reckon this has something to do with the headers and more specifically my from address - since if i change the from email address to the below, then i receive the email.
$headers = 'From: blux@g.com' . "\r\n" .
'Reply-To: blux@g.com' . "\r\n" .
Please can someone show me / tell me what i am doing wrong here and why gmail doesn't like the other from address?
Thanks in advance