I know this seems like it is a duplicate but please read first:
I have the following php code:
<?php
$to = '[email protected]';
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$subject = $_POST['subject'];
$headers = "From: ".$email." \r\n";
$headers .= "Reply-To: ".$email."\r\n";
mail($to, $subject, $message, $headers);
?>
I think it's the standard email sending script. However, I face an interesting bug. My website is florin-pop.com and the emails are only sending when in the email input field I put something like this: [email protected] or [email protected] or anything before @florin-pop.com.
If I try to put a something different like [email protected] or even a real yahoo email address I don't get the email. Why? It's something wrong with my code? It may be from the hosting company? ( I use hostgator ).
EDIT:
If I change the Reply-To to the domains email address then it is working, but it is still not the perfect way to do it. If you press the reply button and forget about this trick, you will email yourself.
Code:
<?php
$to = '[email protected]';
$my_domain_email = '[email protected]';
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$subject = $_POST['subject'];
$headers = "From: ".$email." \r\n";
$headers .= "Reply-To: ".$my_domain_email."\r\n";
mail($to, $subject, $message, $headers);
?>