使用 CodeIgniter 发送电子邮件时出错 [英] Error while sending an email with CodeIgniter
问题描述
在发送电子邮件时,我收到了一堆这样的错误:
While sending an email, I'm receiving a bunch of such errors:
A PHP Error was encountered
Severity: Notice
Message: fwrite(): send of 12 bytes failed with errno=32 Broken pipe
Filename: libraries/Email.php
Line Number: 1846
A PHP Error was encountered
Severity: Notice
Message: fwrite(): send of 39 bytes failed with errno=32 Broken pipe
Filename: libraries/Email.php
Line Number: 1846
A PHP Error was encountered
Severity: Notice
Message: fwrite(): send of 31 bytes failed with errno=32 Broken pipe
Filename: libraries/Email.php
Line Number: 1846
我已按照 CodeIgniter 用户指南配置 SMTP:
I have followed the CodeIgniter user guide to configure an SMTP:
$config['protocol']='smtp';
$config['smtp_host']='ssl0.ovh.net';
$config['smtp_port']='465';
$config['smtp_timeout']='10';
$config['smtp_user']='postmaster%example.com';
$config['smtp_pass']='password';
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['newline'] = "
";
$config['useragent'] = 'Project';
看起来配置文件很好,而且是正确的(我已经检查了 OVH 的电子邮件配置文件).
It seems like the configuration file is just fine, and correct (I've checked the OVH's email configuration files).
有什么解决办法吗?
推荐答案
我也遇到了同样的情况.得到:
I too was in the same situation. Was getting:
消息:fwrite():SSL:管道损坏</p><p>文件名:libraries/Email.php</p><p>行号:2250&
Message: fwrite(): SSL: Broken pipe</p><p>Filename: libraries/Email.php</p><p>Line Number: 2250&
真正产生影响的更改是将smtp_crypto"配置选项设置为ssl"
the change that really made a difference was the 'smtp_crypto' config option set to 'ssl'
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://example.com';
$config['smtp_crypto'] = 'ssl';
$config['smtp_port'] = '465';
$config['smtp_user'] = 'user@example.com';
$config['smtp_pass'] = 'password';
$config['mailtype'] = 'html';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = 'TRUE';
我在 https://www.codeigniter.com/user_guide/libraries 找到了这个解决方案/email.html 通过搜索 SSL 选项.
I found this solution at https://www.codeigniter.com/user_guide/libraries/email.html by searching for SSL option.
这篇关于使用 CodeIgniter 发送电子邮件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!