php mail()函数在macO上不起作用

时间:2019-02-13 07:11:14

标签: php macos xampp brackets

我正在学习使用php发送电子邮件。我设法在macOS Mojave上使用XAMPP括弧,并且正在运行以下脚本

<?php
    $emailTo = "me@mydomain.com"; 
    $subject = "I hope this works!";
    $body = "test simple email";
    $headers = "From: me@mydomain.com";

    if(mail($emailTo, $subject, $body, $headers)){
        echo "Your message was sent, we\'ll get back to you ASAP!";
    } else {
        echo "Your message was not sent successfully.";
    }
?>

导致以下结果:

Your message was not sent successfully.

我是这样做的初学者,我想我可能需要一些反馈。

0 个答案:

没有答案