anton_1 Posted August 5, 2011 Share Posted August 5, 2011 Im having bother setting up a contact form. how easily can this be done. How do I set up my mail server, any tips and hints? Any help would be appreciated. What I'm working on just now: Error Message - Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\xampp\htdocs\mail\processmail.php on line 12 <html> <body> <form method="POST" action="processmail.php"> <input type="text" name="name" size="19"><br> <br> <input type="text" name="email" size="19"><br> <br> <textarea rows="9" name="message" cols="30"></textarea> <br> <br> <input type="submit" value="Submit" name="submit"> </form> </body> </html> <?php if(isset($_POST['submit'])) { $to = "[email protected]"; $subject = "Form Tutorial"; $name_field = $_POST['name']; $email_field = $_POST['email']; $message = $_POST['message']; $body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message"; echo "Data has been submitted to $to!"; mail($to, $subject, $body); } else { echo "blarg!"; } ?> Link to comment https://forums.phpfreaks.com/topic/243920-contact-form-mailing/ Share on other sites More sharing options...
AyKay47 Posted August 5, 2011 Share Posted August 5, 2011 the "From" header is to be added to the additional $headers parameter to be passed as the fourth agument...there is some incorrect syntax here, i suggest you read the manual on the mail function... http://php.net/manual/en/function.mail.php Link to comment https://forums.phpfreaks.com/topic/243920-contact-form-mailing/#findComment-1252477 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.