How to send schedule emails using php without cron

2019-06-13 16:53发布

问题:

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

回答1:

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.



回答2:

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.