how do you do a newsletter (batches) - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: how do you do a newsletter (batches) (/showthread.php?tid=20492) |
how do you do a newsletter (batches) - El Forum - 07-11-2009 [eluser]tomdelonge[/eluser] I don't want to use something like mailchimp. I want to make something myself. Say you have 100 subscriptions. Can you think of a way maybe to have each page visit do 5 or something? Until the list is empty? I don't know if it would be slow or not to check the database every page view to see if any subscriptions are pending. Any ideas? how do you do a newsletter (batches) - El Forum - 07-11-2009 [eluser]richthegeek[/eluser] A simple SQL (MySQL 5+, due to subquery) statement splits the list into groups of 5: Code: SELECT GROUP_CONCAT(email,',') AS recipients FROM emails GROUP BY MOD(id,(SELECT ROUND(COUNT(*) / 6) FROM emails)); You can add a WHERE statement between the FROM and GROUP, or a HAVING afterwards (remembering to add the appropriate column in the fieldlist) to limit by unsent. Hope that helps. how do you do a newsletter (batches) - El Forum - 07-11-2009 [eluser]tomdelonge[/eluser] Do you guys think this is a smart way to accomplish this? @richthegeek that looks good, thanks. how do you do a newsletter (batches) - El Forum - 10-05-2009 [eluser]sophistry[/eluser] i suggest using $this->db->limit(5); and (if you have enough of them visiting your site) tell the robots to do your work: Code: $this->load->library('user_agent'); how do you do a newsletter (batches) - El Forum - 10-05-2009 [eluser]renownedmedia[/eluser] You're all crazy, use cron! how do you do a newsletter (batches) - El Forum - 10-05-2009 [eluser]n0xie[/eluser] indeed use cron: Code: function sendqueue() how do you do a newsletter (batches) - El Forum - 10-05-2009 [eluser]sophistry[/eluser] [quote author="Thomas Hunter" date="1254771604"]You're all crazy, use cron![/quote] ha ha ha! that's the best compliment i can get from someone. all crazy! cron it is. or maybe robots... really i prefer enlisting robots - it makes me feel superior to them. .insert big sig here. |