1

I have a mail trigger functionality to implement, I'm using anspress wordpress plugin for question/answer thing and the scenario here is like, if a question is unanswered for say some 16 hours a mail should me triggered to a Expert Users group saying a post is unswered for such a long time.

Now I have the code for sending email and i'm retrieving the posts also which are left unanswered, But how to trigger this function 16 hours after a post is posted.

immazharkhan
  • 395
  • 2
  • 12
  • Yes I would have, But it should be triggered only once, not repeatedly. Incase i implement cron then mails will be sent regularly and repeatedly to the posts unanswered. Requirement is like a reminder only once. – immazharkhan Oct 27 '15 at 10:54
  • 1
    then you must add some logic for this, like if a mail has already been sent to a user then it must not be triggered again to the same user. – Amrinder Singh Oct 27 '15 at 11:02
  • I was just thinking if there was any other way out. Thanks for the reply, will try with the same. – immazharkhan Oct 27 '15 at 11:04
  • [How to setup cron to run a file just once at a specific time in future?](http://stackoverflow.com/questions/5473780/how-to-setup-cron-to-run-a-file-just-once-at-a-specific-time-in-future) – michaelcarwile Oct 27 '15 at 12:20

1 Answers1

1

As people stated in comments, you could set up a CRON job that only looks for questions that are unanswered and haven't had an email sent.

You could add a field to the questions table in the database to store whether an email has been sent or not for this question.

Daniel Twigg
  • 749
  • 4
  • 22