omegahat / RDCOMClient

GNU General Public License v2.0
77 stars 34 forks source link

Can RDCOMClient be used to monitor emails? #35

Open yb2125 opened 2 years ago

yb2125 commented 2 years ago

Hi,

Is it possible to use RDCOMClient to monitor emails in a Windows environment so that a R script is triggered to run any time an email containing a particular subject is received? If possible, how to set it up? Thanks.

duncantl commented 2 years ago

Hi I rarely use Windows, so my no guarantees on my answer. It may not be the ideal direction, but if you can use RDCOMClient to query new emails for the account, then you should be able to do this. You can either do it in R by having it run all the time and at regular intervals (e.g. every 30 seconds) have it query the new messages, identifying those with the relevant subject and then running an R command (which could be a call to an other non-R command.) You can also use a regularly scheduled job (on UNIX called a cron job) to start R and run the RDCOMClient query to do the same thing - query new messages, find the relevant messages and perform the action.

The better way but which will involve more technologies and less direct R is to have the arrival of each message trigger an action. That could call R and use the RDCOMClient to do the processing. In theory, the RDCOMEvents may work, but is more complex than RDCOMClient.

Hope that helps.

yb2125 commented 2 years ago

Thanks for the guidance. I am able to query emails for the account and run the script on a schedule using Windows Task Scheduler. What do you mean by "having it run all the time" and how to set it up?