如何解决codeigniter中的此电子邮件发送错误?
220 smtp.googlemail.com ESMTP g7sm4210473pgr.52 - gsmtp hello:
250-smtp.googlemail.com at your service, [49.34.9.27]
250-SIZE 35882577
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
Failed to authenticate password. Error: 535-5.7.8 Username and Password not accepted.
Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials g7sm4210473pgr.52 - gsmtp
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
Date: Thu, 14 Nov 2019 04:57:55 +0100 From: "RK Dream Homes" <> Return-Path: <> To: rushiid123@gmail.com Subject: =?UTF-8?Q?Property=20Management?= Reply-To: <> User-Agent: CodeIgniter X-Mailer: CodeIgniter X-Priority: 3 (Normal) Message-ID: <5dccd0c3c0a25> Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="B_ALT_5dccd0c3c0a3c"
This is a multi-part message in MIME format. Your email application may not support this format.
--B_ALT_5dccd0c3c0a3c Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit
你必须检查一些东西(Gmail SMTP(
-
验证电子邮件和密码是否正确。
-
在此处启用不太安全的应用程序
-
在此处启用显示解锁字幕
-
使用主机:
smtp.gmail.com
- 根据
SSL
或TLS
设置使用端口:587
或465
同时根据以下检查newline
$config['newline'] = "rn";
请尝试在CI中使用以下配置,并确保其正确无误。
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.gmail.com';
$config['smtp_user'] = 'apple@gmail.com';
$config['smtp_pass'] = 'password';
$config['smtp_port'] = '465';
$config['mailtype'] = 'html';
$config['starttls'] = false;
$config['charset'] = 'utf-8';
$config['wordwrap'] = TRUE;
$config['smtp_timeout']='30';
$config['newline']="rn";
此外,请确保另一个应用程序允许访问gmail。
有两个步骤来检查gmail帐户。
- 允许不太安全的应用程序访问。https://myaccount.google.com/lesssecureapps
- 允许访问您的谷歌帐户。https://accounts.google.com/b/0/DisplayUnlockCaptcha