Page 1 of 1

Catching mail server 'queue full' error message

Posted: Mon Mar 03, 2008 8:46 am
by Coomkeen
Hi,
I only have about 600 on my newsletter database, but the newsletter is often about 70k of html, and now that I'm going to use Swift and use multipart with a text version as well, it will be a lot bigger.

Previously, not using Swift, the mail server queue has filled up and thrown an error. So I've had to put a 6 second delay between each newsletter being sent.

Is there any way of catching just this 'queue full' error so the 'normal' delay can be short and be extended on error?

I've had the situation where a receiving server has been very slow.

Sorry I'm a bit green on all this stuff :?

One last quick point:
The anti-flood - is the "anti-flood" in quotes supposed to stay there, or is this a reference to something I should put in?
$swift->attachPlugin(new Swift_Plugin_AntiFlood(50, 10), "anti-flood");

Said I was green didn't I? :(

Ron

Re: Catching mail server 'queue full' error message

Posted: Mon Mar 03, 2008 6:30 pm
by Chris Corbyn
PHP4 or 5?

The "anti-flood" should stay there, but you can change it to say something else if you wanted... it's just a key for looking that plugin back up again.

Re: Catching mail server 'queue full' error message

Posted: Tue Mar 04, 2008 7:35 am
by Coomkeen
Thanks Chris,

I did finally (slow brain :( ) gather that it was just a name.

But what I really need to do is catch the mailserver 'queue full' or whatever the error is.
If I throw emails at the server too quickly, and especially if there's been slow response from receiving mailservers, I get an error.

If this could be detected, seperately from any other error, I could keep putting a delay in until the error disappeared. Sort of like a data handshake system.

Regards,
Ron

PS. PHP5

Re: Catching mail server 'queue full' error message

Posted: Tue Mar 04, 2008 7:47 am
by Chris Corbyn
Just wrap your send() call with a try/catch for a Swift_ConnectionException.

Code: Select all

try {
  $swift->send( ... );
} catch (Swift_ConnectionException $e) {
  $errorMessage = $e->getMessage();
  //do whatever....
}
The only way of distinguishing it from other types of SMTP error would be to preg_match() or strpos() for the string in the error message.