• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

PHP to send weekly emails?

lozina

Lifer
I am wondering is it at all possible to have my php application automatically send emails every week?

well, the functionality I need is to be able to schedule a task to be run every week, and for this task to be administrable via the website.

anything in php to do this?

I know I could use a cron job I suppose, but then the user would not be able to administer it from my web applciation...
 
Why can't you write a PHP interface that interacts with cron? Or have the user-facing PHP script store information in a database, and have cron call your own PHP script that reads that information out and sends e-mails based on it.
 
Why can't you write a PHP interface that interacts with cron? Or have the user-facing PHP script store information in a database, and have cron call your own PHP script that reads that information out and sends e-mails based on it.

dont know anything about php interfacing with cron - do you know any articles/examples off the top of your head I could take a look at?

thanks
 
1. Type crontab -e to edit your cron tab. Google 'crontab' if you don't know cron's syntax.

To run something every day, five minutes after midnight:
Code:
MAILTO=""
05 00 * * * /path/to/my/command.sh

2. Set up your command.sh to:
Code:
cat /path/to/email/msg.txt | mail -s "Subject" recipient@a.com -- -F"SenderName"

Happy cron-mailing.
 
You could just have one nightly cron job that kicks off a php script, and the php script would look in the database for jobs that need to be run. Then, you could add as many jobs in your database as you want and the single cron job would run them all.
 
Back
Top