Hi everyone
I have a very quick question relating to the batchsend() method
My script performs several steps before calling swift and starting the send, I've got my own error checking routine to make sure that all goes ok.
Is it possible to show a message after Swift has successfully sent 20 or so messages?
Just to let the user know the potentially lengthy process of sending has started.
Then the user will know that everything's ok with the start of the script, and that sending is underway
Thanks, B
BatchSend echo message after 20 messages sent
Moderators: Chris Corbyn, General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: BatchSend echo message after 20 messages sent
Write a SendListener plugin:
Code: Select all
class Every20Plugin implements Swift_Events_SendListener {
private $_sendCount = 0;
public function sendPerformed(Swift_Events_SendEvent $evt) {
$this->_sendCount++;
if (($this->_sendCount % 20) == 0) {
printf("%s Messages sent\n", $this->_sendCount);
}
}
}
$swift->attachPlugin(new Every20Plugin(), 'SomeKey');