Error while sending an email with CodeIgniter

Scott picture Scott · Dec 4, 2012 · Viewed 35.7k times · Source

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?

Answer

pregmatch picture pregmatch · Apr 14, 2014

If you are using cpanel for your website smtp restrictions are problem and cause this error.

SMTP Restrictions

This feature prevents users from bypassing the mail server to send mail, a common practice used by spammers. It will allow only the MTA, mailman, and root to connect to remote SMTP servers.

This control is also adjustable in Tweak Settings.

This setting has been updated.

The SMTP restriction is disabled.

I had a similar problem and had to disable SMTP Restrictions. After that all was ok.