How to send the mail automatically to respective user before a specific time?
I Have a system which is managing the document authorization on different hierarchy level, In this i need the system to automatically mail to the user for some reminder/notification before 3 days of expiry, I am using PHP MYSQL APA开发者_如何学编程CHE
How can I Achieve this?
make a script, and let cron job do the automatic email sending for you
Or you can use Swiftmailer
You can really only do this with Cron. If your server is a Linux host, you can schedule a PHP script (which you'll need to write) to run at a set time, e.g. every minute. Your script will check against the users database, select any users that are 3 days from expiry and mail them. Setting up cron is host-specific and your hosting provider might not even let you do it. Usually you'll have some server administration software (e.g. cPanel) that will let you schedule a cron job and specify which script to run. If you have SSH access, even easier - you can just SSH in and run crontab -e
to set up a cron schedule yourself. There are plenty of cron tutorials on Google.
Check with your hosting provider if they allow scheduled activities.
精彩评论