Page 1 of 1

log failed errors

Posted: Wed Jun 13, 2007 11:50 am
by phait
hi,
Just wanted to confirm something and ask for advice to mitigate it if possible.

I have to send a newsletter to about 10K addresses each month. I would like to capture all the initial failures like so:

Code: Select all

... sending stuff here...

$failed = $swift->log->getFailedRecipients();

if ($sent) {
    echo("******************** MAILS SENT ********************\n");
    echo("Total of $sent mails sent to recipient\n\n");
}

if (0 < count($failed)) {
    echo("******************** MAILS NOT SENT ********************");
    echo("Total of ".count($failed)." mails were not sent\n");
    foreach($failed as $email) {
        echo("$email\n");
    }
}
but AIUI, all the mails in the queue would have to be sent before I could get a full count.

This may take some time with the amount being sent and a php process would be sitting there waiting for the result, so apart from the obvious answers of "get more ram / faster machine etc", is there any tips on how to speed up the processing to get the failed count in a quicker time?

I'm using the Sendmail Connection as it gives me better results than the NativeMail connection. The box is running Debian Sarge and the script is executed via the CLI.

thanks for your time and any (sensible) advice given,
Paul

Posted: Wed Jun 13, 2007 2:48 pm
by Chris Corbyn
You'd have to wait for the full batch to be sent before you can get the failures yes.

If you're looking for the entire fail count it goes without saying that you have to send them first otherwise Swift will never know what worked and what didn't :? If you want a more verbose solution whereby you get the failures on a per-address basis in realtime, you can use the VerboseSending plugin with your own View (just don't ouptut anything in the view):

http://www.swiftmailer.org/wikidocs/v3/plugins/verbose

Be sure to read the end of the page which explains how to create your own view. Just don't output anything in it, even if this is semantically wrong. l'll change the name at some point so it's not so rigid :)

Posted: Thu Jun 14, 2007 3:48 am
by phait
hey chris,
thanks for the reply. I'll have a butchers a the page referenced... and thanks for just confirming what I thought would need to happen.

paul