I cannot to send an email to myself


I want to send an email to myself. But I don’t receive it.


$to = '**********@gmail.com';
$subject = 'This is an email.';
$body = 'This is a test email'."\
".'Hope you got it';
$headers = 'From: someone@gmail.com';

if (mail($to, $subject, $body, $headers)) {
    echo 'Email has been sent to '.$to;
} else {
    echo 'There was an error sending the email.';


Email has been sent to **********@gmail.com

Thank you!

Does it work if you send it to someone else? Is it being trapped by junk traps? Is the ‘from’ address valid (assuming gmail checks that kind of thing)?

Try adding the email address it’s being sent from to your list of contacts

Thank you! I conjecture that is some kind of a spam buster. Yes?

Thank you very much. I will try it :slight_smile: