doubledee Posted October 9, 2011 Share Posted October 9, 2011 Okay, really dumb question... If I want to make an HTML Form that is really an E-mail Form so that visitors on my website can e-mail me, how do I do that? (I had read in a book last year that if you use an HTML Form, you can reduce/eliminate spam?!) Debbie Quote Link to comment https://forums.phpfreaks.com/topic/248725-e-mail-form/ Share on other sites More sharing options...
Freedom-n-Democrazy Posted October 9, 2011 Share Posted October 9, 2011 $from = $_POST['from']; $subject = $_POST['subject']; $body = $_POST['body']; $header = 'From: Website form - $from'; mail(your@email.com, $from, $subject, $body, $header); There. Quote Link to comment https://forums.phpfreaks.com/topic/248725-e-mail-form/#findComment-1277362 Share on other sites More sharing options...
doubledee Posted October 9, 2011 Author Share Posted October 9, 2011 $from = $_POST['from']; $subject = $_POST['subject']; $body = $_POST['body']; $header = 'From: Website form - $from'; mail(your@email.com, $from, $subject, $body, $header); There. I'm not sure what to do with this code? Don't I need to create an HTML Form? How does this code work with the Form? -------- Also... $header = 'From: Website form - $from'; Why do you add in "Website form - "?? What does that do? Doesn't that break things? mail(your@email.com, $from, $subject, $body, $header); Can't spammers see my e-mail in the line above? I'm totally not understanding how you are daisy-chaining things together. As your code above stands, you would have this... ; mail(your@email.com, $from, $subject, $body, 'From: Website form - $from'); Debbie Quote Link to comment https://forums.phpfreaks.com/topic/248725-e-mail-form/#findComment-1277365 Share on other sites More sharing options...
Freedom-n-Democrazy Posted October 9, 2011 Share Posted October 9, 2011 Yeah, you need to create a HTML form and name your INPUT accordingly: <INPUT name="subject"> No, the client cannot see your PHP code. Web server software will not send it. Quote Link to comment https://forums.phpfreaks.com/topic/248725-e-mail-form/#findComment-1277367 Share on other sites More sharing options...
Freedom-n-Democrazy Posted October 9, 2011 Share Posted October 9, 2011 You all good? Quote Link to comment https://forums.phpfreaks.com/topic/248725-e-mail-form/#findComment-1277378 Share on other sites More sharing options...
KevinM1 Posted October 9, 2011 Share Posted October 9, 2011 An email form is simply a normal HTML form. On the back end, you simply take the $_POST data, validate/filter it like normal, and then put it into the mail function. An HTML email form, by itself, won't do much to eliminate spam. If that's your worry, you'd need to implement some sort of CAPTCHA as well (Google search result for "PHP CAPTCHA" ). Quote Link to comment https://forums.phpfreaks.com/topic/248725-e-mail-form/#findComment-1277481 Share on other sites More sharing options...
doubledee Posted October 10, 2011 Author Share Posted October 10, 2011 You all good? Well, you didn't answer all of my questions... So, here is what I have so far... // Check for Data-Entry Errors. if (empty($errors)){ // Form data clean. // E-mail Inquiry to Administrator. $to = 'debbie@mail.com'; $subject = $trimmed['subject']; $inquiry = $trimmed['inquiry']; $from = $trimmed['senderEmail']; // $headers = $from; mail($to, $subject, $inquiry); // mail($to, $subject, $inquiry, $headers); } Notice, I have been told that if you take out the ampersand and dot that most spambots won't be able to detect your text as an e-mail addy... Is that true? Debbie Quote Link to comment https://forums.phpfreaks.com/topic/248725-e-mail-form/#findComment-1277618 Share on other sites More sharing options...
darkfreaks Posted October 10, 2011 Share Posted October 10, 2011 http://www.allthewebsites.org/articles/deny_spambots_prevent_email_harvesting,2.html Quote Link to comment https://forums.phpfreaks.com/topic/248725-e-mail-form/#findComment-1277624 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.