• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Email library produces weird error while sending mails

#1
Hi there

I'm using the Email library to send large amount of emails. Since my host has a sending limit of 1000 messages per hour, I save them in a database table and then sending 10 of them every couple of minutes through a cronjob.

Recently I noticed that the Email library produces the following error:


Code:
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: 2242
Backtrace:
File: /home/xxx/public_html/application/controllers/Cronjobs.php
Line: 701
Function: send
File: /home/xxx/public_html/index.php
Line: 315
Function: require_once


Does anybody know where this comes from? I've never had an error like that.
Reply

#2
"Broken pipe" means a network connection has failed. Sometimes these things just happen.
Reply

#3
I just contacted my host and the support guy mentioned to try to switch back to php 5.6 (I ran 7.0). Is there a known problem with the Email library and PHP 7.0?
Reply

#4
No.
Reply

#5
(08-31-2017, 11:05 AM)bastian Wrote: I just contacted my host and the support guy mentioned to try to switch back to php 5.6 (I ran 7.0). Is there a known problem with the Email library and PHP 7.0?

You have to remember that it's mainly their job to convince you that their server is perfect, and the problem is your code. In this case I guess blame PHP.
Reply

#6
(09-01-2017, 01:21 PM)skunkbad Wrote: You have to remember that it's mainly their job to convince you that their server is perfect, and the problem is your code. In this case I guess blame PHP.

What would you recommend me to do now?

Seems like there is a problem with the Email library:
https://github.com/bcit-ci/CodeIgniter/issues/5231
Reply

#7
Hi,

Your host might not actually be too happy that you are sending so many emails. It depends on your environment of course. Although you are not breaking the terms of service you are ultimately (or might be) stretching the bounds or the intent of the service.

You perhaps need to look at your own mail exchange server or a dedicated 3rd party service.

This is the first google result I found: https://zapier.com/learn/email-marketing...-services/

From your description it just doesn't seem like a CI problem directly. Perhaps if you really cannot get any real help from your host, try a different host. Skunkbad is exactly right in what he is saying above.

Best wishes,

Paul.
Reply

#8
The host's limit for sending emails is 1000 per hour.

I'm using a cronjob script that sends a batch of 10 mails every 5 minutes. So the limit shouldn't be a problem. I need to talk to the host again.
Reply

#9
Guys, I guess I found the problem.

In the config file for the Email library I had to define the parameter "smtp_timeout" to something significantly higher than the default 5 seconds. I chose 30 seconds.

It seems that my script, that sends a batch of 10 mails every 5 minutes crashed (broken pipe error) because the server lost the smtp connection during the sending process.
Reply

#10
:-)

Infuriating issues like this that seem unresolvable at the time and irreducible are the most hair pulling issues to fix.

Glad you got it sorted.

Paul.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.