<?php
if (isset ($_POST['contact-form'])) {
$name = trim($_POST['name']);
$email = trim($_POST['email']);
$msg = $_POST['message'];
// add the recipient email to a variable
$to = "myemail@gmail.com";
//create a subject
$subject = "$name sent you a message about a qoute";
//construct the message
$message = "Name: $name\r\n";
$message .= "Email: $email\r\n";
$message .= "Message: $name\r\n$msg";
$message = wordwrap($message,72);
//heading and info
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
$headers .= "From: $name <$email>\r\n";
$headers .= "X-Priority: 1\r\n";
$headers .= "X-MSMail-Priority: High\r\n\r\n";
//send email
mail($to, $subject, $message, $headers);
}
?>
The above code is the php code located inside of a .php file with the html in the php file as follows:
<form method="post" action="" id="estimate-form">
<div class="form-group">
<input type="text" class="form-control form control-sm" id="name" placeholder="Name">
<div class="form-group">
<input type="email" class="form-control form control-sm" id="email" placeholder="Email">
<div class="form-group">
<textarea type="textarea" class="form-control form control-lg" id="message" placeholder="Message"></textarea>
</div>
</div>
</div>
</div>
<input type="submit" name="contact-form" value="submit" class="btn btn-outline-light btn-block" style="margin-top:-10px;">
</div>
</div>
</form>
The issue I am having is that Upon submit I am not receiving an email and I can not figure out how to make this operational. Did I make a mistake or leave something out? NOTE: I edited my email out but in my actual code myemail = my actual email address that I left out for privacy!****