iT邦幫忙

0

PHPMailer 與Gmail問題

php

原來使用PHPMailer 透過Google寄信,一切正常。

最近突然無法寄信,並且錯誤訊息為...

SMTP Error: Could not authenticate.
發送錯誤: SMTP Error: Could not authenticate.

請問站上有大大,也遇過類似的問題嗎?

我的程式段落如下

include("class.phpmailer.php");
$code = "utf-8";


$mail= new PHPMailer(); 
$mail->IsSMTP(); 
$mail->SMTPAuth = true; //設定SMTP需要驗證
$mail->SMTPSecure = "ssl"; // Gmail的SMTP主機需要使用SSL連線
$mail->Host = "smtp.gmail.com"; //Gamil的SMTP主機
$mail->Port = 465;  //Gamil的SMTP主機的埠號(Gmail為465)。
$mail->CharSet = $code; //郵件編碼
$mail->Username = $gmailacc; //Gamil帳號
$mail->Password = $gmailpwd; //Gmail密碼
slime iT邦大師 1 級 ‧ 2014-07-30 02:28:14 檢舉
先用一台 PC , 用同樣的設定發發看?
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中
4
蟹老闆
iT邦大師 1 級 ‧ 2014-07-31 08:36:49
最佳解答

當帳戶異常時可能會被gmail鎖定,要不要試試解鎖

2
bluesky1213
iT邦新手 3 級 ‧ 2014-07-30 09:14:35

認證沒過,你把port改成587試試

CalvinKuo iT邦大師 7 級 ‧ 2014-07-30 10:28:57 檢舉
0
enen1980
iT邦研究生 1 級 ‧ 2014-07-31 08:45:23

SSL 465 PORT 正確的TLS 是587
GOOGLE LOGIN ->USER ->ACCOUNT ->SECURITY -> RECENT ACTIVITY 檢查一下.

應該是GMAIL那邊出問題

我要發表回答

立即登入回答