How to send schedule emails using php without cron

2019-06-13 17:22发布

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.

So how can I send schedule mails with my site. Please let me know.

Thanks in advance, Laxmilal Menaria

2条回答
ら.Afraid
2楼-- · 2019-06-13 17:24

You can send emails using visitor hits. Write somewhere (db) the last time you runned job.

$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.

查看更多
疯言疯语
3楼-- · 2019-06-13 17:38

Check out:

http://www.onlinecronjobs.com/

The purpose of this website is to allow website administrators without cronjob service on their own host, run cronjobs.

It claims to be free service although I haven't tried it.

查看更多
登录 后发表回答