Live Sending Status... 'sending x of 685'

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
HiImPaul
Forum Newbie
Posts: 1
Joined: Wed Jul 15, 2009 5:10 am

Live Sending Status... 'sending x of 685'

Post by HiImPaul »

I'm going to be using swiftmailer to handle the dispatch of email campaigns and newsletters which could potentially be sent to large mailinglists (up to 17000 recipients)

When the message is sent, an ajax callback (jquery incase it interests you) is made posting all relevant variables to the php file which will batch send the message. When the callback is made a 'loading animation' fades in, then 'onSuccess' the script returns the relevant success or failure message to the page and the loading animation fades out.

Code: Select all

 
$('#LogLoad').fadeIn();$('html, body').animate({scrollTop:0},1000);
$.ajax({url:'PRO_mail.php',type:'POST',datatype:'script',data:$(this).serialize(),success:function(data){ 
$('#LogResult').html(data);},error:function(){alert('An error occured - please try again!');,
complete:function(){$('#LogLoad').hide();$('#LogResult').fadeIn();RefreshLC();}});
 
As the process could take some time to complete I'd like to be able to see a live sending status and I'm just trying to get my head round the best way to achieve this. I thought I'd see if anyone here has done this before or has any suggestions.

Ideally when the process is occuring I'd like to see a status such as 'sending to 4 of 685' which updates in realtime or refreshes every few seconds to show the latest 'sending to 17 of 685' status.
Leeoniya
Forum Newbie
Posts: 8
Joined: Wed Apr 16, 2008 2:19 am

Re: Live Sending Status... 'sending x of 685'

Post by Leeoniya »

if all you need to do is get the running count, your best bet is to have the script update some txt file containing the count, and have the ajax call query the file or the controller that reads that file.

we update a database and get the counts from that via ajax calls to a status controller. this allows us to track specifically which recipients failed, not just the count.

there is no way to store it in session, because it does not get written out to disk till the script stops running.

Leon
Post Reply