Jump to content

Contact Form Mailing


anton_1

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.