在下面的代碼中,我可以通過phpMyAdmin運行sql,它會返回結果。它不會在瀏覽器上拋出任何PHP錯誤。我似乎無法讓它發送電子郵件。PHP - 從MySQL和電子郵件中提取數據
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
include('database.inc.php'); // Our database connectivity file
?>
<?php
$reminder_date = "t1.`reminder_date`";
$email = "t1.`reminder_email`";
$reminder_name = "t1.`reminder_name`";
$reminder_details = "t1.`reminder_desc`";
$server = "[email protected]";
$sql = "SELECT t1.`reminder_id` , t1.`reminder_name` , t1.`reminder_desc` , t1.`reminder_date` , t1.`reminder_email` , lp4.`email` AS `lp_reminder_email`
FROM `reminder_events` AS t1
LEFT OUTER JOIN `authorize` AS lp4 ON (t1.`reminder_email` = lp4.`email`)
WHERE reminder_date <= NOW()
ORDER BY `reminder_date` ASC";
$result = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($result))
?>
<?php
$to = "$email";
$from = "$server";
$headers = "$from";
$subject = "$reminder_name";
$body = "$reminder_details";
{
$send = mail($to, $subject, $body, $headers);
}
?>
有人告訴我我做錯了什麼嗎? 謝謝。
從底部的郵件功能中刪除@並重試。 「@」是錯誤抑制運算符,任何以此爲前綴的函數都不會拋出錯誤,無論錯誤報告狀態如何。 – castis 2010-11-18 18:29:06
我做到了,仍然沒有收到電子郵件。不要拋出任何錯誤。謝謝。 – KAH 2010-11-18 18:52:21
是否會首先阻止您正在運行的整個區塊? – castis 2010-11-18 18:56:28