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";
Help with webform auto reply
Moderator: General Moderators
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: Help with webform auto reply
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
http://php.net/manual/en/function.mail.php