简体   繁体   English

使用php自动发送电子邮件

[英]sending emails automatically using php

Sorry if this was too easy one. 抱歉,这太简单了。

I am struck with a problem for 3 days. 我被问题困扰了三天。 I need to send emails to the persons whose licence is going to expire. 我需要向许可证即将到期的人发送电子邮件。 The expiry dates will be in mysql database.. I am searching for it since three days,but every answer described is to "start a task manager". 有效期将在mysql数据库中。三天以来我一直在搜索它,但是所描述的每个答案都是“启动任务管理器”。 But i don't understand how the task started in our system can be performed in server..? 但是我不明白如何在服务器中执行在系统中启动的任务。 Is there a way to send emails automatically without manual interaction. 有没有一种方法可以自动发送电子邮件而无需手动交互。 I found lot on CRON JOB.But how can i install it in the server. 我在CRON JOB上发现了很多东西,但是如何将其安装在服务器上。

Please help me if anyone has faced this earlier. 如果有人遇到过这个问题,请帮助我。 Thanks in advance 提前致谢

Ok if you have the php to send emails when the licence is going to expire, as you said you have to use CRON JOBs, if you have cPanel in your webhosting you have them installed. 好的,如果您有PHP可以在许可证将要到期时发送电子邮件,就像您说的那样,您必须使用CRON JOB,如果您的虚拟主机中装有cPanel,则必须安装它们。

http://gyazo.com/20d34f0daa306ab17ac6eb3ce3cce561.png http://gyazo.com/20d34f0daa306ab17ac6eb3ce3cce561.png

http://gyazo.com/8805ff782cfa906f376bcc6a118dd016.png http://gyazo.com/8805ff782cfa906f376bcc6a118dd016.png

On the last image, you will se a command line. 在最后一个图像上,您将使用命令行。

There you should type: 在此输入:

GET http://yourdomain.com/yourphpfile.php GET http://yourdomain.com/yourphpfile.php

Where it says "hour" click the select and click "every hour" then add the new cron and your php file will be called every hour. 在显示“小时”的地方,单击选择,然后单击“每小时”,然后添加新的cron,您的php文件将每小时被调用一次。

If you're on a Linux host, you can use a cron job to check for expired licences. 如果您在Linux主机上,则可以使用cron作业来检查过期的许可证。 If you're on a Windows host, you can use Windows Task Scheduler . 如果您在Windows主机上,则可以使用Windows Task Scheduler If you don't have access to either, there are external services such as Monitor.us , which will visit your web page every hour or so. 如果您没有访问权限,则可以使用Monitor.us之类的外部服务,它每隔一个小时左右就会访问您的网页。

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

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