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: INVALID_ADDRESS@.SYNTAX-ERROR. Below is the PHP. Any help would be really appreciated. PHP: <?php // For FastHosts ini_set("sendmail_from", " email@otbdesign.co.uk"); ini_set("SMTP", "smtp.fasthosts.co.uk"); // Form Fields $EmailFrom = Trim(stripslashes($_POST['EmailFrom'])); $EmailTo = "email@otbdesign.co.uk"; $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\">"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/88175-invalid_addresssyntax-error/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.