简体   繁体   English

如何在没有cron作业的情况下使用php发送计划电子邮件

[英]How to send schedule emails using php without cron job

I want send schedule mails using my php website, I don't want to use cron job because shared hosting environments might not provide all the functions. 我想使用我的php网站发送计划邮件,我不想使用cron作业,因为共享主机环境可能无法提供所有功能。

So how can I send schedule mails with my site. 因此,如何在我的网站上发送计划邮件。 Please let me know. 请告诉我。

Thanks in advance, Laxmilal Menaria 在此先感谢,Laxmilal Menaria

Check out: 查看:

http://www.onlinecronjobs.com/ http://www.onlinecronjobs.com/

The purpose of this website is to allow website administrators without cronjob service on their own host, run cronjobs. 该网站的目的是允许没有cronjob服务的网站管理员在自己的主机上运行cronjobs。

It claims to be free service although I haven't tried it. 它声称是免费服务,尽管我还没有尝试过。

You can send emails using visitor hits. 您可以使用访问者点击数发送电子邮件。 Write somewhere (db) the last time you runned job. 上次运行作业时,在某处(db)写。

$now = time();
if ($now > $last_sent_time + 3600) {
  // code that sends emails
  // goes here ....... 

  set_last_sent_time($now);
}

I think you got the idea. 我想你明白了。 You should put this code on every request to site. 您应该将此代码放在每个对站点的请求上。 The example sends emails every hour. 该示例每小时发送一次电子邮件。

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

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