batterdmooie Posted January 28, 2008 Share Posted January 28, 2008 Hi everyone. I am with fasthosts and have created a form. When it is filled out, I receive the information sent. The problem is I get this message in the from field, instead of the users email address: [email protected]. Below is the PHP. Any help would be really appreciated. PHP: <?php // For FastHosts ini_set("sendmail_from", " [email protected]"); ini_set("SMTP", "smtp.fasthosts.co.uk"); // Form Fields $EmailFrom = Trim(stripslashes($_POST['EmailFrom'])); $EmailTo = "[email protected]"; $Subject = "OTB Design Contact Form"; $Name = Trim(stripslashes($_POST['Name'])); $Tel = Trim(stripslashes($_POST['Tel'])); $Email = Trim(stripslashes($_POST['Email'])); $Message = Trim(stripslashes($_POST['Message'])); // validation $validationOK=true; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; exit; } // prepare email body text $Body = ""; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Tel: "; $Body .= $Tel; $Body .= "\n"; $Body .= "Email: "; $Body .= $Email; $Body .= "\n"; $Body .= "Message: "; $Body .= $Message; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; } ?> Link to comment https://forums.phpfreaks.com/topic/88175-invalid_addresssyntax-error/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.