Thanks for the reply.
I get the $headers); instead of $name, $email1,
but I don’t how I would make a $header: for email1 or name,
Can you please show what that would look like?
Any additional assistance is appreciated.
To send the email name and address in one, they are generally combined in the format:
Dave Green <dgreen@example.com>
so the email address itself is placed between angle brackets, and the two strings placed in the same header field.
Note that if you’re planning on using the form-fillers email address as your “from” address, your mail server might not be happy to send it. You should send the email “from” one of your own addresses, and contain the form information inside the email body, perhaps adding a “reply-to” header with the form-fillers email address in to make it easier to respond.
As can be seen in that post, configuring mail() yourself is a huge PITA, therefore it’s recommended to use a mailing library (SwiftMailer, PHPMailer) that does the hard work.
Thanks for the replies. I’m now trying this (below) and receiving all info except ‘name’. Can you help me with getting ‘name’ received from this Form, please?
<?php
//check if form was sent
if($_POST){
$to = 'contactform@...com';
$subject = 'Testing HoneyPot';
$header = '$name';
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
//honey pot field
$honeypot = $_POST['url'];
//check if the honeypot field is filled out. If not, send mail.
if( $honeypot > 1 ){
return;
}else{
mail( $to, $subject, $message, $email, $header);
}
}
?>
Thanks for your reply, but
I don’t understand that.
The person filling in the Contact Form populates the Name field, Email Field and Test Message Area and selects Send.
So the name has to be in the message area?