Error sending email using CodeIgniter

When sending email, I get a bunch of errors like this:

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 followed the CodeIgniter user guide to configure 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 that the configuration file is just wonderful and correct (I checked the OVH email configuration files).

Any solution for this?

+5
email freebsd smtp codeigniter
Dec 04
source share
6 answers

If you use cpanel for your site, SMTP restrictions are a problem and cause this error.

SMTP Limitations

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

This control is also customizable in Tweak settings.

This option has been updated.

SMTP restriction is disabled.

I had a similar problem and I had to disable the SMTP restrictions. After that, everything was in order.

+5
Apr 14 '14 at 17:01
source share

This is the answer that worked for me

http://biostall.com/resolving-error-with-sending-emails-via-smtp-using-codeigniter/

Be sure to use "\ r \ n", not "\ r \ n"

You can also set this in the configuration file:

 $config['newline'] = "\r\n"; $config['crlf'] = "\r\n"; 
+2
Apr 04 '16 at 20:37
source share

Same problem here ... but for me it was a bunch of settings:

 $config['protocol'] = 'smtp'; $config['smtp_host'] = XXX; $config['smtp_user'] = XXX; $config['smtp_port'] = 25; // was 465 $config['smtp_pass'] = XXX; $config['newline'] = "\r\n"; 

And the message stopped: D

+2
Nov 06 '17 at 17:14
source share

use smpt_port: 25, this worked for me

0
Jan 14 '18 at 2:48
source share

I, too, was in the same situation. It turned out:

Message: fwrite (): SSL: Broken pipe </p> <p> File name: libraries /Email.php </p> Line number: 2250 &

the change that really mattered is the smtp_crypto configuration parameter 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 the SSL option.

0
Mar 13 '18 at 7:22
source share

As for CI, there are so many problems in your email configuration block that it can cause this error.

If you are in a local development environment, try changing the capitalization for "smtp" to "SMTP" in capital letters.

If you are on a real server, try changing them to small caps.

In general, the game with the fill $config['protocol'] = 'smtp' helps several times.

0
Mar 13 '18 at 10:11
source share



All Articles