CodeIgniter Forums
Emailing in batch - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Emailing in batch (/showthread.php?tid=42360)



Emailing in batch - El Forum - 06-05-2011

[eluser]stef25[/eluser]
Is there any way to find out if a batch emailing has been completed? My app will email 100's of people say in batches of 50. For each email sent out there is an accompanying INSERT statement to the DB. If some batches don't get sent out then those INSERTs should not happen or be deleted.

Is there any way I can check this, apart from the return value of $this->email->send() ?


Emailing in batch - El Forum - 06-05-2011

[eluser]JHackamack[/eluser]
Why not use http://ellislab.com/codeigniter/user-guide/database/transactions.html around your email loop. You can put some more logic in the loop if the email doesn't send correctly.


Emailing in batch - El Forum - 06-05-2011

[eluser]stef25[/eluser]
Yes I thought of using transactions. About emailing in a loop: if 5000 emails need to get sent out, will this work? I don't know how much memory this would take up, if it will be a stable process etc.

Anyone have any experience with this?


Emailing in batch - El Forum - 06-05-2011

[eluser]JHackamack[/eluser]
I've been able to send 4,000 emails easily in CI without having a significant memory impact.


Emailing in batch - El Forum - 06-05-2011

[eluser]InsiteFX[/eluser]
if ( ! $this->email->send())
do an error
else
insert data

InsiteFX