contact form email
Posted: Tue Apr 27, 2010 3:46 pm
Hi
I'm having difficulties sending the contents from a contact form to the body of an email.
The email delivers no problem, but only the message is displayed in the body, I'd like to include the email address, name and telephone of the sender in the body of the email.
Could someone please shed some light on this? thanks!
I'm having difficulties sending the contents from a contact form to the body of an email.
The email delivers no problem, but only the message is displayed in the body, I'd like to include the email address, name and telephone of the sender in the body of the email.
Could someone please shed some light on this? thanks!
Code: Select all
<?php
ini_set("sendmail_from", "mail@myemail.com");
$to = "mail@myemail.com";
$name = $_POST['name'];
$email_from =$_POST['email'];
$email = $_POST['email'];
$telephone = $_POST['telephone'];
$message = $_POST['message'];
$subject = "Subject";
$body = "From $name, $telephone, $email, \n\n$message, \n\n$name";
$headers =
"From: $email_from .\n";
"Reply-To: $email_from .\n";
mail($to, $subject, $body, $name);
$sent = mail($to, $subject, $message, $headers, '-f'.$email_from);
?>