how to write a script that automatically sends a mail using data from database

Hello, I am trying my hands on a web application and i need the application to automatically send a mail at a particular set time from the database to corresponding e-mail address. message to be sent, header, recipient info and senders info would be read from the database. All i need is how to automatically initiate the sending of mail once that time is reached on the database.
Fetching the data from database is not an issue though. The main issue is how to do the auto send at the specified time.
Thank you in anticipation.

Hello,

i am also planning on making script just like that so that i can use it personally to store appointment on a database and other important events since i do like the way my phone reminds me.

anyway, i think i’m not sure that you can run a script at a specify time or make it run every X times by using cronjob on your server

Just use Cron. You can write the email script and then have cron run it every day at a specific time or whatever you set your cron to. If you have a windows machine use task scheduler. if you do not have access to cron there are several free cron services out there as well as poormanscron…

a quick google search should yield all the information you need. here is some info on cron

if you need help on how to format and send the email in a php script try this…

http://php.net/manual/en/function.mail.php

ahh thank you andrew i guess i was in right track

Thanks all. Your inputs are appreciated. I’ll get back to you.

Sponsor our Newsletter | Privacy Policy | Terms of Service