Automatic mail sending - 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: Automatic mail sending (/showthread.php?tid=37507) Pages:
1
2
|
Automatic mail sending - El Forum - 01-12-2011 [eluser]Roy MJ[/eluser] Hi, I was wondering if there was any method for sending a static mail automatically. My need is that i have to send a mail for someones birthday who has registered his dob in my database. Is it possible to trigger a mail delivery automatically everyday. ?? Automatic mail sending - El Forum - 01-12-2011 [eluser]Atharva[/eluser] It can be done with setting CRON jobs Automatic mail sending - El Forum - 01-12-2011 [eluser]Roy MJ[/eluser] Thankyou.. Automatic mail sending - El Forum - 01-14-2011 [eluser]Roy MJ[/eluser] Hey, Ive tried doing the cron job. But i cant find a way as to how the command will be like so that i can add a cron job via cpanel. * * * * * /usr/local/bin/php -q /home/public_html/system/application/controller/cron.php But i dont see it working. My cron.php looks like this : Code: <?php Can u please find what im doing wrong here. In cpanel i gave this command as cron job.. Code: $HOME/system/application/controller/cron.php Automatic mail sending - El Forum - 01-14-2011 [eluser]Atharva[/eluser] I suggest you use plain php to run your cron jobs rather than using CI. Also, why this statement is in constructor? Code: * * * * * /usr/local/bin/php5 $HOME/system/scripts/clean_cache.php Automatic mail sending - El Forum - 01-14-2011 [eluser]Atharva[/eluser] Following links will help you Cron wiki cron bootstrapper cron Automatic mail sending - El Forum - 01-14-2011 [eluser]Roy MJ[/eluser] thankyou.. Automatic mail sending - El Forum - 01-14-2011 [eluser]Roy MJ[/eluser] * * * * * /usr/local/bin/php5 $HOME/system/scripts/clean_cache.php When i googled i came across a page where it said the above line is the cron command. I used the below step too. But none of it is triggering the automatic mail sending. * * * * * /usr/local/bin/php5 $HOME/system/application/controller/cron.php Have you implemented the cron job anywhere??. Automatic mail sending - El Forum - 01-14-2011 [eluser]Roy MJ[/eluser] I did it in controller as eventually im planning to do mailing to emails selected from database. So first i was trying to get it working by static contents and static emails. I have found a Cron job application inside the cpanel in the advanced section. In that also we need to give a cron command. The command is what i had mentioned above. But its not working either. If you have done the mail sending, can you please tell me whats wrong with my code. I cant do it in simple php as it would mean i cant access the database. Automatic mail sending - El Forum - 01-14-2011 [eluser]Atharva[/eluser] I usually store my cron files in cron folders. You can also user the db config from system/application/database.php and config values from system/application/config.php in that file. Here is how I do it. Suppose there is a file email_cron.php Code: define( 'BASEPATH', dirname(__FILE__) ); This will include mentioned files, so you can access database settings, base_url etc. Below goes the email code you want to run Code: //select email query, mail code , etc.... You can set through cpanel when this cron will run, and the command will be path to this cron file. For sending mail, you can also use phpmailer. |