Php 在cpanel中使用codeigniter发送电子邮件时出错

Php 在cpanel中使用codeigniter发送电子邮件时出错,php,codeigniter,email,cpanel,Php,Codeigniter,Email,Cpanel,嗨,伙计们,我正在给自己发一封电子邮件,以供测试之用。我已经通过cpanel托管了这个网站,我正在使用Codeigniter库发送电子邮件 这是我控制器中的代码 $config = array(); // $config['useragent'] = "CodeIgniter"; $config['mailpath'] = "/usr/sbin/sendmail"; $config['protocol'] = "smtp"; $

嗨,伙计们,我正在给自己发一封电子邮件,以供测试之用。我已经通过cpanel托管了这个网站,我正在使用Codeigniter库发送电子邮件

这是我控制器中的代码

 $config = array();
// $config['useragent']           = "CodeIgniter";
$config['mailpath']            = "/usr/sbin/sendmail"; 
$config['protocol']            = "smtp";
$config['smtp_host']           = "ssl://smtp.googlemail.com";
$config['smtp_port']           = "465";
$config['smtp_user']="myemail@gmail.com";  
$config['smtp_pass']="mypass";
//  $config['mailtype'] = 'html';
//  $config['charset']  = 'utf-8';
// $config['newline']  = "\r\n";
//  $config['wordwrap'] = TRUE;

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

$this->email->initialize($config);


    $this->email->from('myemail@gmail.com', 'xyz');
    $this->email->to('myemail@gmail.com');

    $this->email->subject('Email Test');
    $this->email->message('Testing the email class.');

    if($this->email->send())
    {
    echo 'Email send.';
    }
    else
    {
    show_error($this->email->print_debugger());
    }
这就是我得到的错误

20 smtp.googlemail.com ESMTP q194sm1834461pfq.43 - gsmtp

hello: 250-smtp.googlemail.com at your service, [43.225.55.90]
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 q194sm1834461pfq.43 - 
gsmtp
Unable to send email using PHP SMTP. Your server might not be configured 
to send mail using this method.

请帮帮我。真的很困惑这个过程应该是怎样的。提前感谢

可能的重复项您是否仍然面临该问题眼睛我仍然面临该问题config['smtp_host']的值应该是多少?@Jerzyk我已经提到了该链接,但解决方案对我不起作用。我也犯了同样的错误。我需要在codeigniter中进行其他设置吗?