PHP邮件命令

时间:2013-01-20 21:37:48

标签: php sql

我遇到了一个PHP邮件命令的问题 当我去处理它时,它只返回一个错误页面..(而不是SQL)

到目前为止,这是我的代码

$getdisputes = mysql_query("SELECT * FROM `disputedetails` WHERE `invno` = '$invoiceno'") or die(mysql_error());
//send email
$to = "".$disputeemail."";
$subject = "Dispute submitted";
$from = "NO_REPLY@noreply.dassdf.com"
$headers = "From:" . $from;
$message1 = "Store ".$username. " has submitted a dispute on invoice number ".$invoiceno;
// foreach line in disputedetails file for that invoice number, add to $message item, desc and 
while ($info = mysql_fetch_array($getdisputes)) {
    $message = $message1 + "\n <b>Invoice Number: </b>".$info['invno']." <b>Item ID:</b> ".$info['itemid']." <b>Description: </b>".$info['description']." <b>Disputed Quantity:</b> ".$info['disputeqty']." Reason: ".$info['reason'].".";
}
mail($to,$subject,$message,$headers);

关于导致问题的原因的任何想法?

2 个答案:

答案 0 :(得分:3)

$from = "NO_REPLY@noreply.dassdf.com"

该行有错误。你需要以“;”结束它分号

像这样:

$from = "NO_REPLY@noreply.dassdf.com";

答案 1 :(得分:1)

更改

$message1 = "Store ".$username. " has submitted a dispute on invoice number ".$invoiceno;
// foreach line in disputedetails file for that invoice number, add to $message item, desc and 
while ($info = mysql_fetch_array($getdisputes)) {
    $message = $message1 + "\n <b>Invoice Number: </b>".$info['invno']." <b>Item ID:</b> ".$info['itemid']." <b>Description: </b>".$info['description']." <b>Disputed Quantity:</b> ".$info['disputeqty']." Reason: ".$info['reason'].".";
}

分为:

$message = "Store ".$username. " has submitted a dispute on invoice number ".$invoiceno;

while ($info = mysql_fetch_array($getdisputes))
    $message .= "\n <b>Invoice Number: </b>".$info['invno']." <b>Item ID:</b> ".$info['itemid']." <b>Description: </b>".$info['description']." <b>Disputed Quantity:</b> ".$info['disputeqty']." Reason: ".$info['reason'].".";