mail("my email is here","Advertising Form","Here is the form data:
Name: " . $_POST['field_1'] . "
Email: " . $_POST['field_2'] . "
Organization or Department: " . $_POST['field_3'] . "
Date of workshop requested: " . $_POST['field_4'] . "
Time of workshop requested: " . $_POST['field_5'] . "
Phone: " . $_POST['field_6'] . "
File that was uploaded: ".$where_form_is."files/".$field_7_filename." (original file name: " . $_FILES['field_7']['name'] . ")
");
When I get the email in Outlook Express the from header looks like my_main_email@serv01.siteground140.com where siteground is my web host provider. I want to change the from so it is the email of the person filling in the form, i.e. $_POST['field_2']
I know the mail()tag but I have been unsuccessful making any changes. I created variable like
---------------------------------
$to = myemailaddress;
$subject = "Contact Form";
$headers = "From: $_POST['field_2']\r\n";
$headers .= "Content-type: text/html\r\n";
$message=<<<EOF
blah
blah
blah
EOF;
Manipulating the header as you suggest is considered SPAM and will likely never make it past a good SPAM filter. You are advised not to use a "From" address that is not a valid email address from your web hosting account. If you are trying to use a valid email from your account and it is not working, please contact your web host tech support and explain your issue. The syntax of your header variable looks OK to me.
Suggestion:
If you want users to be able to send an email after filling your form, create a "mailto:" variable for the user to click. This way the user's own email application will open to send the email using their own account. The mailto method can prepopulate the "To:, Subject:, and Message:" fields.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi folks,
I am playing with the processor.php file.
Here is a piece:
mail("my email is here","Advertising Form","Here is the form data:
Name: " . $_POST['field_1'] . "
Email: " . $_POST['field_2'] . "
Organization or Department: " . $_POST['field_3'] . "
Date of workshop requested: " . $_POST['field_4'] . "
Time of workshop requested: " . $_POST['field_5'] . "
Phone: " . $_POST['field_6'] . "
File that was uploaded: ".$where_form_is."files/".$field_7_filename." (original file name: " . $_FILES['field_7']['name'] . ")
");
When I get the email in Outlook Express the from header looks like my_main_email@serv01.siteground140.com where siteground is my web host provider. I want to change the from so it is the email of the person filling in the form, i.e. $_POST['field_2']
I know the mail()tag but I have been unsuccessful making any changes. I created variable like
---------------------------------
$to = myemailaddress;
$subject = "Contact Form";
$headers = "From: $_POST['field_2']\r\n";
$headers .= "Content-type: text/html\r\n";
$message=<<<EOF
blah
blah
blah
EOF;
mail($to, $subject, $message, $headers);
---------------------------------
Email never gets sent to me when I do this..But the form seems to be being processed. Any suggestions?
Has anyone had header injection problems with the forms created from phpFormGenerator.
All the best...G.L.
Manipulating the header as you suggest is considered SPAM and will likely never make it past a good SPAM filter. You are advised not to use a "From" address that is not a valid email address from your web hosting account. If you are trying to use a valid email from your account and it is not working, please contact your web host tech support and explain your issue. The syntax of your header variable looks OK to me.
Suggestion:
If you want users to be able to send an email after filling your form, create a "mailto:" variable for the user to click. This way the user's own email application will open to send the email using their own account. The mailto method can prepopulate the "To:, Subject:, and Message:" fields.