Welcome Guest, Not a member yet? Register   Sign In
Sending mails (and using cron with CI)

Hi glorsh66,

Quote:is it a good idea to send email in the same script or do i need a make special table in database
It depends, but long running tasks should not blocking the user-interface if its possible.
So yes you could outsource the email-sending. I also would recommand to use a third-party application for email sending like Mailgun.
In that way, you dont have to worry about loading-times/performance issues or scaling in your email-sending.
You get also a direct response, so the user dont have to wait and you dont need to code extra tables etc.
That would be my suggestion.

You can also build a cronjob for this, but than the email would not send in real-time and the user has to wait for that mail, till the cron runs.

Another way, would be to use a message-broker like activemq and schedule the jobs to an consumer, but that might be to way to much, for just sending a registration mail.

Quote:is it possible to use CI (i wanna use CI libraries) with cron? How am i suppose to start it? (because CI start with index.php, not directly from controller..)
Yes thats possible.
I have some cronjobs on my server. I simply call that controll that way:
PHP Code:
/usr/bin/php /var/www/html/yourwebsite/index.php controllername functionname 

Messages In This Thread
RE: Sending mails (and using cron with CI) - by Waschi - 12-18-2017, 09:16 AM

Theme © iAndrew 2016 - Forum software by © MyBB