Contact form code not working. Need help!

Copied from my Answer for “An old plugin self-made stoped sending mail”:

Many E-Mail-Hosters changed their rules to prevent spam. Often times, E-Mails that have one domain name in their “from”-Tag and come from a server with a different domain are rejected. So my guess is, maybe the emails are still sent, but not received.

You can check this by changing this line:

$headers = "From: ".$name." <" . strip_tags($email) . ">\r\n";

to something like this:

$my_domain = $_SERVER['HTTP_HOST'];
$headers="From: orders@".$my_domain."\r\n".'Reply-To: '.$senderEmail."\r\n";

and check if the e-mails are sent and received correctly now. (By setting the Reply-To Header, the correct Address is inserted when clicking on “Reply” in the Mail Client.)