Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Can';无法在codeigniter中从gmail发送电子邮件,SMTP身份验证错误_Codeigniter_Smtp_Gmail_Send - Fatal编程技术网

Can';无法在codeigniter中从gmail发送电子邮件,SMTP身份验证错误

Can';无法在codeigniter中从gmail发送电子邮件,SMTP身份验证错误,codeigniter,smtp,gmail,send,Codeigniter,Smtp,Gmail,Send,我正试图用codeigniter发送电子邮件,但出现了一些问题,我不知道如何解决。 当我在本地主机上发送时,它会成功,但当我将我的应用程序上传到主机上时,它无法发送。这是我的密码 $this->load->library('email'); $config['protocol'] = 'smtp'; $config['smtp_host'] = 'ssl://smtp.gmail.com'; $config[

我正试图用codeigniter发送电子邮件,但出现了一些问题,我不知道如何解决。 当我在本地主机上发送时,它会成功,但当我将我的应用程序上传到主机上时,它无法发送。这是我的密码

        $this->load->library('email');
        $config['protocol']    = 'smtp';
        $config['smtp_host']    = 'ssl://smtp.gmail.com';
        $config['smtp_port']    = '465';
        $config['smtp_timeout'] = '7';
        $config['smtp_user']    = 'username';
        $config['smtp_pass']    = '****';
        $config['charset']    = 'utf-8';
        $config['newline']    = "\r\n";
        $config['mailtype'] = 'html'; // or html
        $config['validation'] = TRUE; // bool whether to validate email or not 
        $this->email->initialize($config);

        $this->email->send();

        echo $this->email->print_debugger();
这是我提交电子邮件时的错误

Failed to authenticate password. Error: 535 Incorrect authentication data 

*from: 250 OK
to: 550-Please turn on SMTP Authentication in your mail client, or login to the
550-IMAP/POP3 server before sending your message.  mb2d247.vdrs.net
550-(hanghieunara.com) [112.78.2.247]:51939 is not permitted to relay through
550 this server without authentication.*

The following SMTP error was encountered: 550-Please turn on SMTP Authentication in your mail client, or login to the 550-IMAP/POP3 server before sending your message.

mb2d247.vdrs.net 550-(hanghieunara.com) [112.78.2.247]:51939 is not permitted to relay through 550 this server without authentication. 

如果您需要授予对站点SMTP服务器(您的电子邮件地址)的访问权限,以便执行身份验证,请查看您的电子邮件帐户是否未处于活动状态,并为外部访问设置了安全性。

要发送经codeigniter验证的SMTP gmail

1-确保php安装中的openssl已启用

2-此命令是脚本工作的基础:$This->email->set_newline(“\r\n”)

$config=Array(

))

$this->load->library('email',$config)

$this->email->set_newline(“\r\n”)

$this->email->from('gmail)。login@googlemail.com‘你的名字’

$this->email->to($this)recipient@destination.tld');

$this->email->subject('CodeIgniter Rocks')

$this->email->message('Hello World')

如果(!$this->email->send())

否则


完整解决方案链接:

可能重复?不,我想不会
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'gmail.login@googlemail.com',
'smtp_pass' => 'your_password',
show_error($this->email->print_debugger());
echo 'Your e-mail has been sent!';