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';
}
と私はこのエラーを取得する:
.... 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. .....
私はポート465
でssl
を使用する場合、私は同じエラーを参照してください。
私のGmail
では、メールアカウント2工場認証はOFF
で、Allow less secure apps
はON
です。
私は本当に何をすべきかわかりません。
SMTPSecureに 'tlc'という設定はありません。 – Synchro