From: Dave M G on
PHP Gurus,

I have a set of scripts that sends out emails to a list of about 150
people. Sometimes it works fine.

Other times, it dies part way through the list, and in my error logs I
get this output:

fputs() [<a href='function.fputs'>function.fputs</a>]: send of 22 bytes
failed with errno=32 Broken pipe /public_html/class.smtp.php 489

The code that sends the mail is derived from here:
http://www.phpclasses.org/browse/file/920.html

It's mostly rock solid code, so far as I know, so I suspect the problem
to more with my server settings or something.

That said, I don't know what differentiates a failed mailing and a
successful one.

After a Google search, it seems "broken pipes" are a matter of time
outs. That's about as far as I understand it, though.

Can anyone throw me a tip as to how I might diagnose this problem?

Thank you for any advice.

--
Dave M G

From: "Bob McConnell" on
From: Dave M G

> I have a set of scripts that sends out emails to a list of about 150
> people. Sometimes it works fine.
>
> Other times, it dies part way through the list, and in my error logs I

> get this output:
>
> fputs() [<a href='function.fputs'>function.fputs</a>]: send of 22
bytes
> failed with errno=32 Broken pipe /public_html/class.smtp.php 489
>
> The code that sends the mail is derived from here:
> http://www.phpclasses.org/browse/file/920.html
>
> It's mostly rock solid code, so far as I know, so I suspect the
problem
> to more with my server settings or something.
>
> That said, I don't know what differentiates a failed mailing and a
> successful one.
>
> After a Google search, it seems "broken pipes" are a matter of time
> outs. That's about as far as I understand it, though.
>
> Can anyone throw me a tip as to how I might diagnose this problem?

"Broken pipe" is a euphemism for "Network error". There are any number
of causes including the remote server closing the socket, a switch or
hub between here and there is bogged down by backup traffic, or a
segment your connection passes through became too busy with higher
priority video traffic. The actual details are difficult to determine
and none of the administrators involved will ever admit they had a
problem. In most cases the TCP/IP error will simply tell you it timed
out waiting for a response. Your code should be able to re-open the
connection at this point and resend the message that triggered the
error. Then resume working on the rest of your list.

Bob McConnell
From: "=?utf-8?B?YXNoQGFzaGxleXNoZXJpZGFuLmNvLnVr?=" on
Could it be that there are connection limits on the remote server?

Thanks,
Ash
http://www.ashleysheridan.co.uk

----- Reply message -----
From: "Bob McConnell" <rvm(a)CBORD.com>
Date: Wed, Sep 8, 2010 18:24
Subject: [PHP] Broken pipes, time outs, PHP, and mail
To: <php-general(a)lists.php.net>

From: Dave M G

> I have a set of scripts that sends out emails to a list of about 150
> people. Sometimes it works fine.
>
> Other times, it dies part way through the list, and in my error logs I

> get this output:
>
> fputs() [<a href='function.fputs'>function.fputs</a>]: send of 22
bytes
> failed with errno=32 Broken pipe /public_html/class.smtp.php 489
>
> The code that sends the mail is derived from here:
> http://www.phpclasses.org/browse/file/920.html
>
> It's mostly rock solid code, so far as I know, so I suspect the
problem
> to more with my server settings or something.
>
> That said, I don't know what differentiates a failed mailing and a
> successful one.
>
> After a Google search, it seems "broken pipes" are a matter of time
> outs. That's about as far as I understand it, though.
>
> Can anyone throw me a tip as to how I might diagnose this problem?

"Broken pipe" is a euphemism for "Network error". There are any number
of causes including the remote server closing the socket, a switch or
hub between here and there is bogged down by backup traffic, or a
segment your connection passes through became too busy with higher
priority video traffic. The actual details are difficult to determine
and none of the administrators involved will ever admit they had a
problem. In most cases the TCP/IP error will simply tell you it timed
out waiting for a response. Your code should be able to re-open the
connection at this point and resend the message that triggered the
error. Then resume working on the rest of your list.

Bob McConnell

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

From: Dave M G on
Bob,

Thank you for replying.

> Your code should be able to re-open the
> connection at this point and resend the message that triggered the
> error. Then resume working on the rest of your list.

Unfortunately, it seems that this is not happening. The loop that sends
out individual mail dies, and the remaining mails stop being sent.

Is there perhaps some way I can force the PHP code to ignore the one
mailing that failed and continue with the rest?

--
Dave M G
From: "=?utf-8?B?YXNoQGFzaGxleXNoZXJpZGFuLmNvLnVr?=" on
In order to help we really need to have a look at the code in question. You say the code is derived from another class you downloaded. Are you able to post the important bits of it in an email, or put it all on a pastebin?

Thanks,
Ash
http://www.ashleysheridan.co.uk

----- Reply message -----
From: "Dave M G" <martin(a)autotelic.com>
Date: Wed, Sep 8, 2010 18:45
Subject: [PHP] Broken pipes, time outs, PHP, and mail
To: <php-general(a)lists.php.net>

Bob,

Thank you for replying.

> Your code should be able to re-open the
> connection at this point and resend the message that triggered the
> error. Then resume working on the rest of your list.

Unfortunately, it seems that this is not happening. The loop that sends
out individual mail dies, and the remaining mails stop being sent.

Is there perhaps some way I can force the PHP code to ignore the one
mailing that failed and continue with the rest?

--
Dave M G

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php