0

我正在使用 php 邮件通知我的订阅者有新的博客文章。
因为我的下面的函数没有发送,所以我决定添加一个错误捕获器,并且 mail() 返回 true,它显示了我的电子邮件地址,但是电子邮件没有发送。请帮忙

$sql = "SELECT * FROM subscribers";
    while ($ste = mysqli_fetch_array(mysqli_query($con,$sql)))
    {
    $messager="
<html>
<head>
<title>Check out what's happening on my Blog this week</title>
<body>
";  
$date = date("Y-m-d H:i:s",mktime(date("H"),date("i"),date("s"),date("m"),date("d")-7));
    $sqli = "SELECT * FROM blog WHERE date > '$date' LIMIT 2";
    $res = mysqli_query($con,$sqli);
    while ($jw = mysqli_fetch_array($res))
    {
    $messager = $messager."<h2>$jw[header] by $jw[author]</h2><p>".substr($jw["text"], 0, 250)."..."."</p><br>";
    }
    $messager = $messager."</body></html>";
    // To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: <no-reply@zinteen.co.uk>';
$headers .= "X-Mailer: PHP/" . phpversion(); 
   $ma= mail("$ste[email]", "Check out what's happening on my Blog this week",
    $messager, $headers);
    if ($ma)
    die("should've worked.".$ste["email"]);
    }
}
4

2 回答 2

0

与服务器管理员联系,或尝试使用 SMTP 并提供身份验证凭据

非常有用的 php 邮件类

http://phpmailer.worxware.com/index.php?pg=examplebsmtp

于 2013-09-12T16:53:42.087 回答
0

您应该以另一种方式定位您的报价:

$ma= mail($ste["email"], "Check out what's happening on my Blog this week",
$messager, $headers);

我在您的电子邮件中更改了它们。

于 2013-09-12T16:59:47.380 回答