|
 |
|
รบกวนสอบถามค่ะ ใช้ phpMailer แต่อีเมล์ไม่ยอมส่งไปยังปลายทางค่ะ |
|
 |
|
|
 |
 |
|
พอดีว่าทำระบบสมัครสมาชิก โดยให้สมาชิกทำการ Activate ผ่านอีเมล์ค่ะ
แต่อีเมล์ไม่สามารถส่งไปยังผู้สมัครได้เลย ไม่ทราบว่าเกิดข้อผิดพลาดตรงไหน 
อันนี้โค้ดนะคะ
Code
<?
ob_start();
include("config.php");
$action=$_GET["action"];
$id=$_GET["id"];
?>
<?
if($action=="save"){ // insert and update to DB
$file=$_FILES["mem_image"];
copy($file["tmp_name"],"upload/".$file["name"]);
$image_path="upload/".$file["name"];
$member_kkd=$_POST["member_kkd"];
$member_name=$_POST["member_name"];
$member_lastname=$_POST["member_lastname"];
$member_birthday=$_POST["member_birthday"];
$member_email=$_POST["member_email"];
$access_key=md5(rand());
$sql="insert into member(member_kkd,
member_name,
member_lastname,
member_birthday,
member_password,
member_email,
access_key)
values('$member_kkd',
'$member_name',
'$member_lastname',
'$member_birthday',
'$member_password',
'$member_email',
'$access_key')";
$result=mysql_query($sql);
if(mysql_error()){
echo mysql_error();
}else{
require_once('class.phpmailer.php');
$mail = new PHPMailer();
$mail->IsHTML(true);
$mail->IsSMTP();
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->Username = "[email protected]"; // GMAIL username
$mail->Password = "********"; // GMAIL password
$mail->From = "[email protected]"; // "[email protected]";
$mail->FromName = "[email protected]"; // set from Name
$mail->Subject = "สวัสดีค่ะ ทดสอบการส่งเมล์ค่ะ";
$mail->Body = 'ทดสอบการส่งเมล์ค่ะ';
$mail->AddAddress("$member_email"); // to Address
$mail->set('X-Priority', '3'); //Priority 1 = High, 3 = Normal, 5 = low
if(!$mail->Send())
{
echo 'Mailer Error: ' . $mail->ErrorInfo.'<br />';
}
else
{
echo 'Message has been sent<br />';
}
header("Location:index.php");
}
}else{ // Form add and edit
?>
<?
}
ob_flush();
?>
รบกวนพี่ๆช่วยชี้แจงด้วยนะคะ ว่าทำอะไรผิดตรงไหน
ขอบคุณมากๆค่ะ
Tag : PHP, MySQL, HTML/CSS

|
|
 |
 |
 |
 |
Date :
2014-12-23 12:11:30 |
By :
iceziism |
View :
675 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แสดงว่าเป็นที่ Mail Server แล้วครับ ลองส่งหา Domain ภายใน Host ดูครับ
|
 |
 |
 |
 |
Date :
2014-12-23 12:43:31 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ตอนนี้ได้แล้วค่ะ เป็นที่ gmail จริงๆด้วย
ขอบคุณมากๆนะคะ 
|
 |
 |
 |
 |
Date :
2014-12-23 13:17:28 |
By :
iceziism |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|