简体   繁体   中英

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 APACHE

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, eg 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 (eg 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM