使用php邮件功能通过ssmpt发送电子邮件

时间:2017-04-11 04:23:36

标签: php email nginx sendmail smpp

所以我已经安装了ssmpt并使用ssmpt成功测试了电子邮件发送。

现在的问题是,php邮件功能无法发送电子邮件。 我试过,php.ini中的以下配置

sendmail_path = sendmail -t -i
or
sendmail_path = /usr/sbin/ssmpt -t
or
sendmail_path = /usr/sbin/sendmail -t

我的简单php文件如下:

<?php
$to = "to@gmail.com";
$subject = "HTML email";

$message = "
    <html>
    <head>
       <title>HTML email</title>
    </head>
    <body>
      <p>This email contains HTML Tags!</p>
    </body>
    </html>";

// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";


mail($to,$subject,$message,$headers);
?>

0 个答案:

没有答案