[FIXED] mass emailing, fatal error mid-send
Moderators: Chris Corbyn, General Moderators
[FIXED] mass emailing, fatal error mid-send
(sorry to bother you) Using php4, swift3
I'm using Swift to send say 3 emails to forum members (1000+).
Basically midway through the first email (after 5 min) I get:
Fatal error: Uncaught Error of type [swift_connection_exception] with message [Expected response code(s) [250] but got response 0]
Its hard to test because some users get the email, others dont.
The recipient array is fine, set_time_limit(0) and ignore_user_abort().
And phpBB's mass emailer sent 1000 emails fine, so I don't know the problem.
Thanks for any suggestions, im very unknowing
I'm using Swift to send say 3 emails to forum members (1000+).
Basically midway through the first email (after 5 min) I get:
Fatal error: Uncaught Error of type [swift_connection_exception] with message [Expected response code(s) [250] but got response 0]
Its hard to test because some users get the email, others dont.
The recipient array is fine, set_time_limit(0) and ignore_user_abort().
And phpBB's mass emailer sent 1000 emails fine, so I don't know the problem.
Thanks for any suggestions, im very unknowing
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Brilliant 
EDIT | Would you like to give this one a go and see what it says?
http://www.w3style.co.uk/~d11wtq/trunk.zip [1.4MB]
It will extract to a folder called "trunk" containing php4 and php5 subdirectories. It's potentially the release I'll be making in a few hours unless it's still not working for you.
EDIT | Would you like to give this one a go and see what it says?
http://www.w3style.co.uk/~d11wtq/trunk.zip [1.4MB]
It will extract to a folder called "trunk" containing php4 and php5 subdirectories. It's potentially the release I'll be making in a few hours unless it's still not working for you.
Fatal error:
Uncaught Error of type [swift_connection_exception] with message [Expected response code(s) [250] but got response []]
@0 swift::batchsend() in /home/promed/www/html/Swift/mass_emailer.php on line 119
@1 swift::send() in /home/promed/www/html/Swift/lib/Swift.php on line 539
@2 swift::command() in /home/promed/www/html/Swift/lib/Swift.php on line 432
could be something on my part?
Uncaught Error of type [swift_connection_exception] with message [Expected response code(s) [250] but got response []]
@0 swift::batchsend() in /home/promed/www/html/Swift/mass_emailer.php on line 119
@1 swift::send() in /home/promed/www/html/Swift/lib/Swift.php on line 539
@2 swift::command() in /home/promed/www/html/Swift/lib/Swift.php on line 432
could be something on my part?
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Darn! 
I know what's causing it too... I just want it to actually tell people that!. There's actually an error being generated which will says something like "There was a problem reading the SMTP response at line x. The response so far is [yyyy]". That is of type Swift_Connection_Exception and because PHP4 doesn't do exceptions, it's being caught by the wrong expect() call in Swift (i.e. it's ambiguous). That's my fault (in PHP5 it would never happen)... all I need to do is define a specific type of exception for bad response codes and this will be solved. I should have thought of that before!
Sorry, I'm thinking out loud again....
How many emails is it sending before giving up? Have you checked that your server allows you to send 1000 (or even more than 100 for that matter) at any one time? I'll have to sort out that error though... some text would be useful
I know what's causing it too... I just want it to actually tell people that!. There's actually an error being generated which will says something like "There was a problem reading the SMTP response at line x. The response so far is [yyyy]". That is of type Swift_Connection_Exception and because PHP4 doesn't do exceptions, it's being caught by the wrong expect() call in Swift (i.e. it's ambiguous). That's my fault (in PHP5 it would never happen)... all I need to do is define a specific type of exception for bad response codes and this will be solved. I should have thought of that before!
Sorry, I'm thinking out loud again....
How many emails is it sending before giving up? Have you checked that your server allows you to send 1000 (or even more than 100 for that matter) at any one time? I'll have to sort out that error though... some text would be useful
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Brilliant 
It was a simple matter of making the identity of a particular exception different from that of another. PHP4 doesn't have support for try/catch & exceptions, so I rolled my own implementation I aptly dubbed to be a "hackaround" when I converted the library to PHP4. It is type-aware like exceptions are, and it does throw error objects around, but it's just not too clever at knowing which exception you wanted when two are thrown in sequence. I created a new type for a specific purpose and now we're good
In code, I changed this:
To this:
It was a simple matter of making the identity of a particular exception different from that of another. PHP4 doesn't have support for try/catch & exceptions, so I rolled my own implementation I aptly dubbed to be a "hackaround" when I converted the library to PHP4. It is type-aware like exceptions are, and it does throw error objects around, but it's just not too clever at knowing which exception you wanted when two are thrown in sequence. I created a new type for a specific purpose and now we're good
In code, I changed this:
Code: Select all
Swift_Errors::expect($e, "Swift_ConnectionException");
if (!$e) //blah
if (!$e) //blah
if (!$e) {
//nothing caught
Swift_Errors::clear("Swift_ConnectionException");
} else {
//Exception caught so we failed
}Code: Select all
Swift_Errors::expect($e, "Swift_BadResponseException");
if (!$e) //blah
if (!$e) //blah
if (!$e) {
//nothing caught
Swift_Errors::clear("Swift_BadResponseException");
} else {
//Exception caught so we failed
}