Why does our "Contact Us" form code fail to deliver the users email to our gmail account
if sender uses a yahoo email address?
To test we reduced the code to a minimum and only changed the From address.
Works: From myemail@mywebsite.com
Fails: From myemail@yahoo.com
(actual email addresses were used in each case)
Yes, we looked in the spam folder and all others as well. Not there.
Here is the code:
<?php $name = "Me";
$email = "myemail@yahoo.com";
$message = "test message 1 on 6-7-20";
$formcontent="From: $name \n Message: $message";
$recipient = "mysiteadmin@gmail.com";
$subject = "test message on 6-7-20";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Sent to ".$recipient." from ".$email";
?>