Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 557
Scott Avatar asked Dec 04 '12 00:12

Scott


1 Answers

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'] = '[email protected]';
$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.

like image 141
Stefan P Avatar answered Nov 15 '22 01:11

Stefan P