我的邮件功能不起作用?

时间:2015-08-02 18:27:55

标签: php email web sendmail

以下代码段不起作用。

我查看了我的php.ini文件,但看起来不错。

它没有返回任何错误。

我听说过使用名为sendmail的内容。

我正在使用Mac。

我做错了什么?

<form action="" method="post">
    <button class="btn" type="submit" name="submit" value="submit">CLICK</button>
</form>
<?php
    if(isset($_POST['submit'])) {
        error_reporting(); 
        $to  = 'philipnagel511@gmail.com';
        $subject = 'subject';
        $message = 'text';
        $headers  = 'MIME-Version: 1.0' . "\r\n";
        $headers .= 'Content-type: text/html; charset=windows-1251' . "\r\n";
        $headers .= 'To: user <philipnagel511@gmail.com>' . "\r\n";
        $headers .= 'From: server <nipdeliveries@gmail.com>' . "\r\n";
        mail($to, $subject, $message, $headers);
    }
?>

1 个答案:

答案 0 :(得分:0)

您需要配置PHP配置使用的电子邮件服务器。 Here是如何进行此设置的指南。提到的Postifix是Mac的标准配置,也可以安装在Linux上。

相关问题