【问题标题】:Can't send email from gmail in codeigniter, SMTP Authentication error无法在 codeigniter 中从 gmail 发送电子邮件,SMTP 身份验证错误
【发布时间】:2013-11-24 11:05:39
【问题描述】:

我正在尝试在 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. 

【问题讨论】:

标签: codeigniter smtp gmail send


【解决方案1】:

如果您需要授予对站点的 SMTP 服务器(您的电子邮件地址)的访问权限,以便执行身份验证,请查看您的电子邮件帐户是否没有激活外部访问的 difinições 安全性。

【讨论】:

    【解决方案2】:

    使用 codeigniter 发送 smtp gmail 验证

    1 - 确保您的 php 安装中的 openssl 是否已启用。

    2- 此命令是脚本工作的基础:$this->email->set_newline("\r\n");

    $config = 数组(

    'protocol' => 'smtp',
    'smtp_host' => 'ssl://smtp.googlemail.com',
    'smtp_port' => 465,
    'smtp_user' => 'gmail.login@googlemail.com',
    'smtp_pass' => 'your_password',
    

    );

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

    $this->email->set_newline("\r\n");

    $this->email->from('gmail.login@googlemail.com', '你的名字');

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

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

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

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

    show_error($this->email->print_debugger());
    

    其他

    echo 'Your e-mail has been sent!'; 
    

    完整解决方案链接:https://ellislab.com/forums/viewthread/84689/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-21
      • 1970-01-01
      • 2014-05-15
      • 1970-01-01
      • 2016-11-15
      • 1970-01-01
      • 1970-01-01
      • 2015-07-08
      相关资源
      最近更新 更多