This question already has an answer here:
I'm using PHP Mailer for the contact tab, but when emails are sent to gmail, they go straight SPAM. How to avoid this?
Here's my code:
<?php
if(isset($_POST['submit'])){
$to = "myemail@myemail.com"; // Receiver's Email address
$form_name = $_POST['form-name']; // Sender's Name
$from_email = $_POST['form-email']; // Sender's Email address
$form_phone = $_POST['form-phone']; // Sender's Phone
$form_message = $_POST['form-message']; // Sender's Message
$subject = "Quote Request"; // Request Quote Subject
// Email message
$message = "Someone has requested a quote. Form details are below: \n\n" . "Name: " . $form_name . "\nPhone: " . $form_phone . "\n\nMessage: " . "\n\n" . $form_message . "\n\nReply directly to this e-mail to reach " . $form_name . " or give them a call at " . $form_phone . ".";
$headers = "From:" . $from_email;
mail($to,$subject,$message,$headers);
header('Location: success.html');
}
?>
Thanks!