Page 1 of 1

Help with webform auto reply

Posted: Fri Nov 05, 2010 6:56 am
by phpnewbie10
I am new to php . I've added an auto reply email script to my webform to go out when the summit button is clicked, which works.
The problem I have is that when the email arrives at the destination inbox, it appears to come from anonymous@domainname.com, instead of info@domainname.com. The emails are treated as spam mail and goes directly to the junk box. My web host provider now thinks I am are sending spam mail from our site and temporarily disconnect the page.
Could somone please help me fix this. The script is below


if($_POST['btnSubmit']=="Send")

{
echo "Thank You. Your registration was successfully sent.";
}

$to = "$email";
$from = "info@domainname.com";
$subject = "Registration confirmation";
$body = <<< emailbody


This email confirms your registration. We will contact you as soon as possible


emailbody;
$success = mail($to,$from,$subject,$body,
"From:$from\r\nReply-To:"info@domainname.com";

Re: Help with webform auto reply

Posted: Fri Nov 05, 2010 1:11 pm
by Jonah Bron
Invalid argument. You're using the second argument to mail as the from field. The manual shows the correct usage:

http://php.net/manual/en/function.mail.php