Sending a large number of emails |
[eluser]PhilTem[/eluser]
It really sounds like a reasonable approach - I thought of pushing you towards using cronjobs as I was about to reading the 5th paragraph. But then you mentioned it yourself. Anyway, you don't need to have a snippet of PHP script in your database. I had a similar task to accomplish in a project one year ago and ever since then I'm using the same code for other projects. Let me just tell you my experience and talk a little about my business logic: First of all you're right, you will want to use cronjobs to send out so many emails since you might end up with exceeding the maximum execution time for a PHP script if you wanted to use either PHP's mail() or CI's email library. The problem however, you need root access to your server in order to install a cronjob that's run under the webserver's username. But that shouldn't be a problem here. What you would put in your crontab file can be of two different kinds: - Either put a call to the PHP CLI (command line input) and refer to the CI user's guide on how to use the CLI - Put a "wget http://www.example.com/controller/method/args" in it I'm usually going with the second one since I can store the output in a nicer way to a custom log file. Now, since we will basically be making a simple GET-Request to some controller of our page, we need to create this. How you create it doesn't matter, it should just grab the recipients from a database, grab the content of the mail from your database and mix it together to make an email. Then you can loop over e.g. 10 recipients per call to your cron-controller and you want put too much load on your system. If you want to have a look at my controller, have a look here (Right now I'm too lazy to write more in here, but you can hopefully understand a bit from my code). The libraries and models used for it can be found inside the same module by just browsing to the corresponding folder ![]() I had very good experiences with this setup however it was a little bit difficult setting up the cronjob correctly and without any errors. But that was due to not knowing how to use cronjobs ![]() For any questions just post here or contact me at philipp (at) ignitedco (dot) de |
Messages In This Thread |
Sending a large number of emails - by El Forum - 09-12-2012, 11:47 AM
Sending a large number of emails - by El Forum - 09-12-2012, 02:38 PM
Sending a large number of emails - by El Forum - 09-12-2012, 03:40 PM
Sending a large number of emails - by El Forum - 09-12-2012, 04:21 PM
Sending a large number of emails - by El Forum - 09-13-2012, 05:08 AM
|