I copied some PHP mailer and at some point had it working. But the thing is, I think it's missing something I want specifically, I need to make the final email output display like below:
Name: [name of sender here]
Subject: [subject here]
Message: [message here]
See if the format above can be done I would like to add a company input field too at some point. here's he php mailer below:
<?php
//print_r($_POST);
if(isset($_POST['_save'])) {
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$subject = $_POST['subject'];
if (empty($name) || empty($email) || empty($subject) || empty($message)) {
if (empty($name))
$error['name'] = "Please enter your Full Name";
if (empty($email))
$error['email'] = "Please enter a valid Email Address";
if (empty($subject))
$error['subject'] = "Please Write a Subject";
if (empty($message))
$error['message'] = "lease write a message, inquiries or other concerns above";
}
else { //if not empty
$headers="From: {$email}\r\nReply-To: {$email}"; //create headers for email
mail('email@domain.com',$subject,$message,$headers); //mail the message;
$success = "Thank you! You're email has been sent.";
#done;
}
}
?>
For your first question, change
mail('email@domain.com',$subject,$message,$headers);
to
$content="Name: ".$name."<br>Subject: ".$subject."<br>Message: ".$message;
mail('email@domain.com',$subject,$content,$headers);
As for your second question, as Jan states, add a company name field to your form and do exactly the same as with the name/subject/message variables.