|
|
|
สอบถามเรื่องของการส่ง เมล์ครับผม มีปัญหาครับ ช่วยทีครับ ทำโปรเจค |
|
|
|
|
|
|
|
Code (PHP)
<?
include('ConnectDB.php');
include('PHPMailer_v5.1/class.phpmailer.php');
$auction_id = $_POST['auctionid'];
$cus_id = $_COOKIE['id'];
$cm_detail = $_POST['comment'];
function smtpmail( $email , $subject , $body )
{
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->CharSet = "utf-8"; // ????????? ????????????? tis-620 ???? windows-874 ?????????????????????
$mail->Host = "smtp.gmail.com"; // mail server ??????
$mail->Port = 465; // Port ??? Google
$mail->SMTPAuth = true; // ????????????????????? ??? SMTP
$mail->SMTPSecure = "ssl";
$mail->Username = "[email protected]"; // account e-mail ?????????????????????
$mail->Password = "xxxxxxx"; // ???????? e-mail ?????????????????????
$mail->From = "[email protected]"; // account e-mail ?????????????????????????
$mail->FromName = "Market@bid"; // ????????????????? ???????????????????????????
$mail->AddAddress($email); // Email ???????????????????????(????????????)
$mail->IsHTML(true); // ??? E-mail ??? ????????????????????? tag html ????????? ???? true
$mail->Subject = $subject; // ??????????????(????????????)
$mail->Body = $body; // ??????? ????????(????????????)
$result = $mail->send();
return $result;
}
$sql= "
SELECT MAX(comment_auction_id) MAX_CUSTOMER_AUCTION_ID FROM comment_auction
";
$query = mysql_db_query($dbname, $sql) or die("Can't Query 1");
$cm_id = mysql_fetch_array($query);
$id = $cm_id[0] + 1 ;
$sql2=" INSERT INTO comment_auction(comment_auction_id, comment_detail, auction_id, customer_id)VALUES('$id','$cm_detail','$auction_id','$cus_id') ";
$query2 = mysql_db_query($dbname, $sql2) or die("Can't Query 2");
$sql3 = " SELECT email FROM customer WHERE customer_id IN (SELECT customer_id FROM track_auction WHERE auction_id = '$auction_id') ";
$query3 = mysql_db_query($dbname, $sql3) or die("Can't Query 3");
while ($result = mysql_fetch_array($query3))
{
$subject = 'Market@bid';
$body = ' Comment : ' .$_POST['comment'];
$email = $result[0];
smtpmail($email,$subject,$body);
}
echo "<script language='javascript'>";
echo "alert('Success.');";
echo "document.form1.submit();";
echo "</script>";
mysql_close();
?>
<body onLoad="document.form1.submit();">
<form id="form1" name="form1" method="get" action="Product_auction.php">
<input name="auction_id" id="auction_id" type="hidden" value="<?=$auction_id;?>">
</form>
</body>
ส่งแค่1-2คนไม่เป็นอะไรครับ แต่พอส่งสัก 4คนขั้นไปมีปญาหาครับ ส่งไม่ครบบ้าง หน้าไม่กลับไปหน้า Product_auction.php ด้วยครับ งงเลยครับไม่รู้จะแก้ยังไงครับ
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2011-03-10 16:41:26 |
By :
tangsupap |
View :
930 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|