Error while sending an email with CodeIgniter
codeigniter, email, freebsd, smtp
Solution
I too was in the same situation. Was getting:
Message: fwrite(): SSL: Broken pipe</p><p>Filename: libraries/Email.php</p><p>Line Number: 2250&
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';
I found this solution at https://www.codeigniter.com/user_guide/libraries/email.html by searching for SSL option.
Problem
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 ``` 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'] = "\r\n"; $config['useragent'] = 'Project'; ``` It seems like the configuration file is just fine, and correct (I've checked the OVH's email configuration files). Any solution for that?