This question already has an answer here:
I am pretty new to all this and I need some help. This is the most basic mail function in PHP.
<?php
$headers = "Content-Type: text/html; charset=UTF-8";
$name=$_POST['name'];
$email=$_POST['email'];
$subject=$_POST['subject'];
$phone=$_POST['phone'];
$message=$_POST['message'];
$to ="maria@mkitra.com";
$subject2 = "Work";
mail($to, $subject2, $message, $headers, $name);
echo "Message Sent";
?>
It does send the email but my problem is that the mail function doesn't include either the user's email nor their phone number. How do I include them in the email?
I have tried
mail($to, $subject2, $message, $headers,$phone,$email $name);
But it says, the mail
function can take maximum 5 parameters. I am confused.
</div>
You can use this
<?php
$to = $_POST['email']; //Whom you want to send
$from = "maria@mkitra.com"; //Your email id
$subject = $_POST['subject'];
$message = '<!DOCTYPE html><html><head><meta charset="UTF-8"><title>yoursitename Message</title></head><body><span>Mobile</span><span>'.$phone.'</span><span>Name</span><span>'.$name.'</span></body></html>';
$headers = "From: $from
";
$headers .= "MIME-Version: 1.0
";
$headers .= "Content-type: text/html; charset=iso-8859-1
";
mail($to, $subject, $message, $headers);
echo "Message Sent";
Email only send to and email subject and email body and email type mean header. No send mobile number or name or any other things. If you add this then you add on your under email body