PHP邮件功能无法发送邮件到Gmail

时间:2018-11-21 20:15:17

标签: php gmail

<?php

    if ($_POST['submit']) {
        $name = $_POST['name'];
        $email = $_POST['email'];
        $message = $_POST['message'];
        $from = 'From: yoursite.com'; 
        $to = 'saadmasood353@gmail.com'; 
        $subject = 'Customer Inquiry';
        $body = "From: $name\n E-Mail: $email\n Message:\n $message";
        if (mail ($to, $subject, $body, $from)) { 
            echo '<p>Your message has been sent!</p>';
        } else { 
            echo '<p>Something went wrong, go back and try again!</p>'; 
        }
    }
?>

0 个答案:

没有答案