The anti-flood plugin two posts above this one has been updated. The second constructor parameter is an optional pause in seconds between re-connection.
Lets say you want to send say 10,000 emails in batches of 100 at a time with a 10 second pause between each 100 to give the poor SMTP server a rest.
A combination of set_time_slimit() and ignore_user_abort() with the anti-flood plugin makes this possible.
You'd do something like this and then open it in your browser. As soon as the script starts to run just kill your browser window and the mails will be sent in the background with a 10 second pause between each 100. This will take (obviously) a minimum of 990 seconds + the network overhead for the data to be sent but you don't need to sit and wait. I tested it by sending 1000 emails to my won address with a disconnect after each 10 and a 2 second pause. It worked well even when I closed the browser.
Code: Select all
set_time_limit(0);
ignore_user_abort(); //Vital maybe
$swift = new Swift($connection);
//100 mails per connection, 10 second pause between connections
$swift->loadPlugin(new Swift_Anti_Flood_Plugin(100, 10));
$recipients = array(); //Fill this with the 10,000 recipients you want
$swift->send($recipients, $your_address, $subject, $body);
$swift->close();

