Question

I'm building a web application. One of the major feature of this application is, it sends email to all the users based on their preferences which can be set weekly or monthly. The email sending has to be executed using cron. The email will contain a csv or xml file which is actually a report for the user generated by the system. That means, each user will get different file. And there can be thousands of users. I'm using codeigniter framework for the app.

My question is, what will be the efficient way for this kind situation? I didn't use cronjob previously. So, I'm afraid about the server resources it will take for this kind of execution. I also want to know how much time it will take for sending 1000 such email and is their any chances of execution time out or server crash? And should I use codeigniter's built in email class?

Was it helpful?

Solution

You should have no problem to run this type of task via cron jobs, as @Ranty says there is no timeout, in CLI the maximum execution time is set to unlimited.

The time that it will take depends on your server, the time to retrieve the csv that you will attach... as @Ranty says is a good choice to run your cronjobs at night.

And finally yes, if you are using CI why not use the codeigniter's built in email class? For running scripts via command line read this: http://ellislab.com/codeigniter/user-guide/general/cli.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top