php - Unread email notifier, most practical approach -


I am in the process of writing a small php-cli script which will loop on my personal inbox and then one login SMS via door.

I have a question:

The script will launch every 10 minutes by the Kronon, if an email sits in my inbox that is not read before I launch the next script 2 will get the SMS.

Anyone (Pseudocode) has any idea what the best practice in PP5 will be, to ensure that only 1 SMS is sent?

How am I currently learning that a message is storing ID id in SQLite DB and to flag a field whether the SMS has been sent or not - but is thinking that Is there an easier way?

You do not have to store anything. If I understand you correctly, you want your program to send you a message, if any new, unread emails have come within the last 10 minutes. In that situation, can not you do the following?

  foreach ($ inbox [] as the message) {if (($ message.isUnread) & amp; ($ message.receiveTime & gt; now () - 10 minutes )) {$ SendMessage = TRUE; }} If ($ sendMessage) {sendMessage (); }  

I do not know how you are able to access the data, so the above mentioned use is not worth it-assuming that you read the status and the content of your inbox Can filter, however, in theory this should not work?


Comments

Post a Comment

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -