[跪地哭求]mail()問題 收發不了email

edited 十月 2013 in PHP新手區
我用php5,apache,phpmyadmin2.5.7&mysql4.0.20建了一個購物網站。由電郵發送會員訂單功能出問題了,代碼如下:
payment.php:
<?require \'connectdb.php\';?>
<?require \'pagetop.php\';?>
<?if ($store_user==""){?>
<b><p><big>PS:要購物請先『<a href="login.php">登入</a>』
<?}else{?>
<?$query="SELECT order_id,prod_id,quantity,date from transaction where username=\'$store_user\' ";
$result=mysql_query($query);
$chid=mysql_num_rows($result);?>
<?if ($chid==0) {?>
<b><p><big>您已經完成付費動作,如果要再購買請到『網上購物』。
<meta http-equiv=Refresh content=2;url=list.php>
<?}else{?>
<br><b><big>完成付費訂購動作</big></b><br>
您的訂單:您共訂購 <?echo $chid?> 個物品,我們會儘快以貨到付款的方式送到您府上<br>
      並寄出一張購物明細到您的信箱中,最後感謝您購買我們的商品。<p>
<i>(訂購明細)<i>
<table border=1><tr>
<td bgcolor=#ffcc00>物品編號</td>
<td bgcolor=#ffcc00>物品名稱</td>
<td bgcolor=#ffcc00>產品類型</td>
<td bgcolor=#ffcc00>數量</td>
<td bgcolor=#ffcc00>單價</td>
<td bgcolor=#ffcc00>加總</td>
<td bgcolor=#ffcc00>日 期</td></tr>
<?$buf="--您的購物明細------------------------------------------------------\\n";?>
<?while(list($order_id,$prod_id,$quantity,$date)=mysql_fetch_row($result)) {?>
<?$query1="SELECT prod_no,prod_name,prod,price FROM prod_shop where prod_id=\'$prod_id\'";
  $result1=mysql_query($query1);
  list($prod_no,$prod_name,$prod,$price)=mysql_fetch_row($result1)?>
<tr><td><small><?echo $prod_no?></td>
<td><small><?echo $prod_name?></td>
<td><small><?echo $prod?></td>
<td><small><center><?echo $quantity?></td>
<td><small><center><?echo $price?></td>
<td><small><center><?echo $price*$quantity?></td>
<td><small><?echo $date?></td>
</tr>
<?$buf=$buf."No:".$prod_no."物品名:".$prod_name."產地:".$prod."\\n數量:".$quantity."價格:".$price."\\n\\n";?>
<?$sum=$sum+$price*$quantity?>
<?}?>
<tr><td>  </td><td colspan=7>總價:$<?echo $sum?>.00</td></tr>
</form>
</table>
<p>[<a href="list.php">回Christy\'s購物城</a>]<br>
<?$query="SELECT name,sex,telphone,address,email,username from user where username=\'$store_user\' ";
  $result=mysql_query($query);
  list($name,$sex,$telphone,$address,$email,$username)=mysql_fetch_row($result)?>
<? # 寄給使用者
  $mail_title="Hi dear『".$username."』這是您的購物明細";
  $mail_message="‧首先感謝您在『Christy\'s購物城』購物,您將會在\\n";
  $mail_message=$mail_message." 近日收到我們寄給您的貨到付款的包裹,隨信付\\n";
  $mail_message=$mail_message." 上您的購物明細。\\n";
  $mail_message=$mail_message.$buf;
  $mail_message=$mail_message."總 價:".$sum."\\n";
  $mail_message=$mail_message."-------------------------------------------------------------------\\n\\n";
  $mail_message=$mail_message."您的物品我們將會再2天內為您送到,請耐心等候\\n";
  $mail_message=$mail_message."最後再特別感謝您的消費。";
   mail ($email,$mail_title,$mail_message,"Content-Type: text/plain; charset=\\"big5\\"\\nContent-Transfer-Encoding: quoted-printable");

  # 寄給管理者
  $mail_title="管理者,『".$username."』網友下訂單囉!!";
  $mail_message="‧管理者有一封新的訂單是由網友『".$username."』訂購的,\\n";
  $mail_message=$mail_message." 請儘快處理完畢,下面是網友的必要資訊。\\n\\n";
  $mail_message=$mail_message."『".$username."』網友訂購的物品如下\\n";
  $mail_message=$mail_message.$buf;
  $mail_message=$mail_message."總 價:".$sum."\\n";
  $mail_message=$mail_message."-------------------------------------------------------------------\\n\\n";
  $mail_message=$mail_message."下面是『".$username."』網友的通訊資料\\n";
  $mail_message=$mail_message."真實姓名:".$name."\\n";
  $mail_message=$mail_message."性別:".$sex."\\n";
  $mail_message=$mail_message."電話:".$telphone."\\n";
  $mail_message=$mail_message."郵寄地址:".$address."\\n";
  $mail_message=$mail_message."PS:請儘快將貨品寄給訂購人";
   mail ("[email protected]",$mail_title,$mail_message,"Content-Type: text/plain; charset=\\"big5\\"\\nContent-Transfer-Encoding: quoted-printable");?>
<?$query="delete from transaction where username=\'$username\'";
  $result=mysql_query($query);?>
<?  }
}?>
在php.ini修改了:
mail function]
; For Win32 only.
SMTP = smtp.gmail.com
smtp_port = 465

; For Win32 only.
sendmail_from = [email protected]

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =

根據gmail的 pop setting( http://mail.google.com/support/bin/answer.py?answer=13276 )在outlook express設定好了,在outlook express是可以發電郵的。但是當我在自己的購物網按 "送出結帳" 雖然是可以去到下一頁(說已經發電郵確認書的那個),但是收不到email, 怎麼辦?急死了...

另外,我建了一個mailing list, 需要用到mail server, 所以我下載了mailtraq, 但安裝後不懂使用,有人可以教教我嗎?

原始討論: http://twpug.net/x/modules/newbb/viewtopic.php?topic_id=1484

評論

Sign In or Register to comment.