【问题标题】:Unable to send emails SMPT errors in codigniter 3无法在 codeigniter 3 中发送电子邮件 SMTP 错误
【发布时间】:2016-11-15 11:11:06
【问题描述】:

这是我的代码,我尝试了 smtp_port 587,465,也尝试了 25。但我无法发送电子邮件。而且我的网站不是 SSL,所以我避免使用 ssl://smtp.googlemail.com 而不是使用 smtp.googlemail.com 并且我也尝试使用 ssl ://smtp.googlemail.com

public function email()
{
     $config = Array(
        'protocol' => 'smtp',
        'smtp_host' => 'smtp.googlemail.com',
        'smtp_port' => 465,
        'smtp_user' => '******',
        'smtp_pass' => '******',
        'mailtype'  => 'html', 
        'charset'   => 'iso-8859-1'
    );
    $this->load->library('email', $config);
    $this->email->set_newline("\r\n");

    $this->email->from('uvizag@gmail.com', 'Vizag updates');
    $this->email->to('siddharthaesunuri@gmail.com'); 
    $this->email->subject('Activation link...! Vizag updates');
    $msg = "your activation link <a href='base_url'>click here</a>";
    $this->email->message($msg);
    $this->email->send();
    echo $this->email->print_debugger();    
}

我该如何解决这个问题?您能帮我吗?感谢您的宝贵回答

Please click to show my errors

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

【问题讨论】:

标签: php codeigniter email smtp codeigniter-3


【解决方案1】:

当我收到该错误时,我的身份验证出现了问题。

确保禁用两步验证或启用安全性较低的应用的访问权限。

This tutorial 帮了我大忙。

希望对你有帮助

【讨论】:

  • @Siddhu 你试过设置 'smtp_crypto' => 'ssl' 吗?
  • 是的,我试过@jonas。之后,我收到此警告严重性:警告消息:fsockopen():无法连接到 ssl://smtp.gmail.com:465(连接被拒绝)文件名:libraries/Email.php
【解决方案2】:

终于解决了

我们需要授予谷歌访问权限 https://support.google.com/accounts/answer/6010255?hl=en

public function send()
{
    $config = Array(
        'protocol' => 'smtp',
        'smtp_host' => 'ssl://smtp.googlemail.com',
        'smtp_port' => 465,
        'smtp_user' => '****@gmail.com',
        'smtp_pass' => '***',
        'mailtype'  => 'html', 
        'charset'   => 'iso-8859-1'
    );
    $this->load->library('email', $config);
    $this->email->set_newline("\r\n");
    $this->email->from('uvizag@gmail.com', 'admin');
    $this->email->to('siddharthaesunuri@gmail.com, siddhu.php@gmail.com');
    $this->email->subject('Registration Verification:');
    $message = "Thanks for signing up! Your account has been created...!";
    $this->email->message($message);
    if ( ! $this->email->send()) {
        show_error($this->email->print_debugger());
    } 

}

【讨论】:

    【解决方案3】:
    $config['smtp_crypto'] = 'ssl';
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-08-24
      • 2016-11-19
      • 1970-01-01
      • 2022-01-21
      • 2013-11-24
      • 1970-01-01
      • 2014-06-07
      相关资源
      最近更新 更多