简体   繁体   English

如何在特定时间之前自动将邮件发送给相应的用户?

[英]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 我有一个系统,它管理不同层次结构级别的文档授权,在此我需要系统在3天到期之前自动向用户发送一些提醒/通知,我使用的是PHP MYSQL APACHE

How can I Achieve this? 我怎样才能实现这个目标?

make a script, and let cron job do the automatic email sending for you 制作一个脚本,让cron job为你自动发送电子邮件

Or you can use Swiftmailer 或者你可以使用Swiftmailer

You can really only do this with Cron. 你真的只能用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. 如果您的服务器是Linux主机,则可以安排PHP脚本(您需要编写)以在设定的时间运行,例如每分钟运行一次。 Your script will check against the users database, select any users that are 3 days from expiry and mail them. 您的脚本将检查用户数据库,选择到期后3天的任何用户并邮寄它们。 Setting up cron is host-specific and your hosting provider might not even let you do it. 设置cron是特定于主机的,您的托管服务提供商可能甚至不允许您这样做。 Usually you'll have some server administration software (eg cPanel) that will let you schedule a cron job and specify which script to run. 通常你会有一些服务器管理软件(例如cPanel),它可以让你安排一个cron作业并指定运行哪个脚本。 If you have SSH access, even easier - you can just SSH in and run crontab -e to set up a cron schedule yourself. 如果您有SSH访问权限,则更容易 - 您可以通过SSH进入并运行crontab -e来自行设置cron计划。 There are plenty of cron tutorials on Google. Google上有很多cron教程。

Check with your hosting provider if they allow scheduled activities. 如果他们允许预定的活动,请咨询您的托管服

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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