简体   繁体   English

如何解决 codeigniter 中的 email 发送错误

[英]How to solve this email sending error in codeigniter

How can I solve this email sending error in codeigniter?如何解决 codeigniter 中的此 email 发送错误?

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

You must check few things (Gmail SMTP)您必须检查几件事(Gmail SMTP)

  1. Verify Email and Password are correct.验证 Email 和密码是否正确。

  2. Enable Less Secure App Here在此处启用不太安全的应用程序

  3. Enable Display Unlock Captcha here在此处启用显示解锁验证码

  4. Use Host: smtp.gmail.com使用主机: smtp.gmail.com

  5. Use Port: 587 or 465 as per SSL or TLS setting根据SSLTLS设置使用端口: 587465

Also check newline as per below还要检查newline ,如下所示

$config['newline'] = "\r\n";

Please try to use below configuration in CI and make sure it's correct.请尝试在 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']="\r\n";

Also, please ensure that gmail is allowed to access by another app.另外,请确保 gmail 被其他应用程序允许访问。

There are 2 steps to check in gmail account.有两个步骤可以检查 gmail 帐户。

  1. Allow less secure app access.允许不太安全的应用程序访问。 https://myaccount.google.com/lesssecureapps https://myaccount.google.com/lesssecureapps
  2. Allow access to your Google account.允许访问您的 Google 帐户。 https://accounts.google.com/b/0/DisplayUnlockCaptcha https://accounts.google.com/b/0/DisplayUnlockCaptcha

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM