Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 30082

PHP Mailer messages go to Gmail Spam, how to fix this? [duplicate]

$
0
0

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!


Viewing all articles
Browse latest Browse all 30082

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>