scotterson Posted November 5, 2008 Share Posted November 5, 2008 hello, I am new here, and this is my first time using PHP, so I think it is probably a simple fix. I am making a contact form (which is working fine), but would like to add an auto response to the sender. I have found a few other forums with similar help topics, but they have not worked for me. I looked a little on here and didn't find the same topic, but I apologize if this has been asked recently. Anyways, here is what I have so far. $sendTo = "[email protected]"; $subject = "Scott Cleveland Design Contact Form"; $headers = "From: " . $_POST["name"]; $headers .= "<" . $_POST["email"] . ">\r\n"; $headers .= "Reply-To: " . $_POST["email"] . "\r\n"; $headers .= "Return-Path: " . $_POST["email"]; $message = $_POST["message"] . " \r\n \r\nPhone: " . $_POST["phone"] . " \r\n \r\nLocation: " . $_POST["location"]; mail($sendTo, $subject, $message, $headers); thanks so much for any help! -scott Link to comment https://forums.phpfreaks.com/topic/131451-email-php-help/ Share on other sites More sharing options...
xcoderx Posted November 6, 2008 Share Posted November 6, 2008 explain properly ??? Link to comment https://forums.phpfreaks.com/topic/131451-email-php-help/#findComment-683451 Share on other sites More sharing options...
haku Posted November 6, 2008 Share Posted November 6, 2008 Add: $to = $_POST['email']; $subject = 'Thank you'; $message = 'Your message has been sent. We will contact you shortly.' mail($to, $subject, $message); Your mail form is very open to abuse at the moment right now however. You are taking the information that has been put into the browser and sending it as is with no check as to the data that is inside. That is asking for someone to use your form to spam people. Link to comment https://forums.phpfreaks.com/topic/131451-email-php-help/#findComment-683465 Share on other sites More sharing options...
scotterson Posted November 6, 2008 Author Share Posted November 6, 2008 thank you very much, i will try this tonight. as far as the security issue, how can I fix that? Link to comment https://forums.phpfreaks.com/topic/131451-email-php-help/#findComment-684072 Share on other sites More sharing options...
haku Posted November 8, 2008 Share Posted November 8, 2008 That's too long of a question to answer in one post really. You need to validate inputs to make sure they don't contain any harmful code, and to ensure that they contain the data they are supposed to. Google 'injection attacks', and 'making my php mail form safer' and stuff like that. There is lots of info about it out there on the web. Link to comment https://forums.phpfreaks.com/topic/131451-email-php-help/#findComment-685121 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.