Jump to content

Recommended Posts

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\">";
}
?>

 

Link to comment
https://forums.phpfreaks.com/topic/88175-invalid_addresssyntax-error/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.