function email($reqNo){
//Database Configurations
$host = "example.com.au";
$username = "example";
$pass = "example";
$db = "example_db";
//Customer Configurations
$cName = null;
$cEmail = null;
$DBConnect = @mysqli_connect($host, $username, $pass, $db) or die
("<p>Unable to connect to the database server.</p>". "<p>Error code ". mysqli_connect_errno().": ". mysqli_connect_error()). "</p>";
$SQLString = "SELECT name, email FROM Customer WHERE cust_no = '" .$_GET["cno"]. "'";
$queryResult = @mysqli_query($DBConnect, $SQLString) or die
("<p>Unable to query the $TableName table.</p>"."<p>Error code ". mysqli_errno($DBConnect). ": ".mysqli_error($DBConnect)). "</p>";
$row = mysqli_fetch_row($queryResult);
while ($row) {
$cName = $row[0];
$cEmail = $row[1];
$row = mysqli_fetch_row($queryResult);
}
mysqli_close($DBConnect);
// Email Information Configurations
$pdate = date("Y-m-d", strtotime($_GET["p_date"]));
$ptime = date("H:i:s", strtotime($_GET["p_time"]));
$to = $cEmail;
$header = "From: admin@shiponline.com";
$subject = "Shipping Request with ShipOnline";
$message = "Dear $cName, Thank you for using ShipOnline! Your request number is $reqNo. "
."The cost is " .calCost(). ". We will pick-up the item at $ptime on $pdate.";
// Send Email
if (mail($to, $subject, $message, $header))
ECHO "Sent";
else
ECHO "Not Sent";
}
邮件功能未成功执行,因此转到else语句。我有在线资料,讲座笔记的双重检查。但仍然无法弄清楚我错过了什么或错误。
P / S:我正在使用Notepad ++进行编码。