2017-06-03 160 views
0

我有使用Google SMTP和PHPMailer最新版發送郵件的問題。這裏有很多問題,但答案對我無效。 我正在使用免費子域名000webhost。 這是我從PHPMailer文檔發送電子郵件標準的PHP代碼:發送郵件SMTP GMail和PHPMailer

$mail->isSMTP(); 
$mail->Host = 'smtp.gmail.com'; 
$mail->SMTPAuth = true; 
$mail->Username = 'GMAIL EMAIL ACCOUNT'; 
$mail->Password = 'MY PASSWORD FOR GMAIL EMAIL ACCOUNT'; 
$mail->SMTPSecure = 'tlc'; 
$mail->Port = 587; 
$mail->SMTPDebug = 3; 
$mail->setFrom('EMAIL ADDRESS', 'EXAMPLE'); 
$mail->addAddress('ADDRESS TO SEND', 'From contact form'); 

$mail->addCC('[email protected]'); 
$mail->addBCC('[email protected]'); 

$mail->Subject = 'Here is the subject'; 
$mail->Body = 'This is the HTML message body <b>in bold!</b>'; 
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; 

if(!$mail->send()) { 
    echo 'Message could not be sent.'; 
    echo 'Mailer Error: ' . $mail->ErrorInfo; 
} else { 
    echo 'Message has been sent'; 
} 

,我得到這個錯誤:如果我使用ssl與港口465

.... 2017-06-03 15:15:33 SERVER -> CLIENT: 535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials 203sm11822739ywk.62 - gsmtp 2017-06-03 15:15:33 SMTP ERROR: Password command failed: 535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials 203sm11822739ywk.62 - gsmtp 2017-06-03 15:15:33 SMTP Error: Could not authenticate. .....

我看到同樣的錯誤。

在我的Gmail電子郵件帳戶2廠認證是OFFAllow less secure appsON

我真的不知道該怎麼做。

+0

'SMTPSecure'沒有'tlc'這樣的設置。 – Synchro

回答

相關問題