Php CodeIgniter邮件功能在本地运行良好,但在live和raise错误中未运行

Php CodeIgniter邮件功能在本地运行良好,但在live和raise错误中未运行,php,codeigniter,Php,Codeigniter,我的codeigniter邮件功能在我的本地应用程序中运行良好,但同一代码无法实时运行,并引发错误 我认为这个错误是密码不匹配。但我检查了我的密码,密码是正确的 以下是我的错误消息: An Error Was Encountered 220 smtp.googlemail.com ESMTP s189-v6sm30071511pgc.39 - gsmtp hello: 250-smtp.googlemail.com at your service, [181.224.149.217] 250

我的codeigniter邮件功能在我的本地应用程序中运行良好,但同一代码无法实时运行,并引发错误

我认为这个错误是密码不匹配。但我检查了我的密码,密码是正确的

以下是我的错误消息:

An Error Was Encountered

220 smtp.googlemail.com ESMTP s189-v6sm30071511pgc.39 - gsmtp

hello: 250-smtp.googlemail.com at your service, [181.224.149.217]
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: 534-5.7.14 Please log in via your web browser and 534-5.7.14 then try again. 534-5.7.14 Learn more at 534 5.7.14 https://support.google.com/mail/answer/78754 s189-v6sm30071511pgc.39 - gsmtp
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

User-Agent: CodeIgniter
Date: Sat, 5 May 2018 14:39:51 +0530
To: tprakash11121996@gmail.com
From: "MyWebsite" <tprakashkce@gmail.com>
Return-Path: <tprakashkce@gmail.com>
Subject: =?utf-8?Q?=48=6F=77=20=74=6F=20=73=65=6E=64=20=65=6D=61=69=6C=20=76=69=61?= =?utf-8?Q?=20=53=4D=54=50=20=73=65=72=76=65=72=20=69=6E=20=43=6F=64=65=49?= =?utf-8?Q?=67=6E=69=74=65=72?=
Reply-To: "tprakashkce@gmail.com" <tprakashkce@gmail.com>
X-Sender: tprakashkce@gmail.com
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <5aed74df89302@gmail.com>
Mime-Version: 1.0


Content-Type: multipart/alternative; boundary="B_ALT_5aed74df89342"

This is a multi-part message in MIME format.
Your email application may not support this format.

--B_ALT_5aed74df89342
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Billed Patient DetailsDear Sir/madam, We are attached billed patient files
in this mail


--B_ALT_5aed74df89342
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

=3Ch1=3EBilled Patient Details=3C/h1=3E=3Cp=3EDear Sir/madam,=3Cbr=3E We ar=
e attached billed patient files in this mail=3C/p=3E

--B_ALT_5aed74df89342--
我也试图更改端口号,但没有用 在这里我将清空我的密码。但我还是要说密码是正确的

这是我的密码:

  public function sendMail(){

        $this->load->library('email');

        //SMTP & mail configuration
        $config = array(
            'protocol'  => 'smtp',
            'smtp_host' => 'ssl://smtp.googlemail.com',
            'smtp_port' => 465,
            'smtp_user' => 'example@gmail.com',
            'smtp_pass' => '*********',
            'mailtype'  => 'html',
            'charset'   => 'utf-8'
        );
        $this->email->initialize($config);
        $this->email->set_mailtype("html");
        $this->email->set_newline("\r\n");

        //Email content
        $htmlContent = '<h1>Billed Patient Details</h1>';
        $htmlContent .= '<p>Dear Sir/madam,<br> We are attached billed patient files in this mail</p>';

        $this->email->to('tprakash11121996@gmail.com');
        $this->email->from('tprakashkce@gmail.com','MyWebsite');
        $this->email->subject('How to send email via SMTP server in CodeIgniter');
        $this->email->message($htmlContent);

        if($this->email->send()){
            echo "Mail Succesfully send";
        }
        else{
            show_error($this->email->print_debugger());
        }
        }

为什么会在live中引发错误?

正如您所说,密码是正确的,但它说的是密码不匹配,因为google限制您登录google mail

要发送消息,您需要更改google帐户中的某些设置

要做到这一点,请先登录到您的google帐户,然后转到此处并打开“允许不太安全的应用”


请转到此处,允许谷歌访问,然后再试一次。它会工作。

您是否在配置中提供了密码tprakashkce@gmail.com帐户密码我设置了正确的密码,但我仅在此页面中删除了密码。您必须检查live server是否允许发送smtp邮件。大多数情况下,您需要从服务器授予权限如何查找smtp邮件主机名以及如何更改rediff mail中的邮件设置任何人请帮助您很好:如何查找smtp邮件主机名以及如何更改rediff mail中的邮件设置任何人请帮助只需在其他stackOverflow问题中询问此问题而不在评论中:i他问了一个新问题。链接是,帮帮我?