首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用gmailr定期搜索

使用gmailr定期搜索
EN

Stack Overflow用户
提问于 2018-08-16 04:36:13
回答 1查看 66关注 0票数 1

我想按固定主题的特定电子邮件定期搜索我的gmail收件箱。有人知道我怎样才能自动执行这个搜索吗?我正在使用gmailr包。任何想法都将不胜感激。

致以最好的问候,海伦

EN

回答 1

Stack Overflow用户

发布于 2018-11-14 17:00:58

我找到了一个使用AWS的解决方案。我在detail here上写了这篇文章。

简而言之,您需要做的是:

亚马逊网络服务设置了一个instance.

  • Write a功能来检查电子邮件。下面是我的函数。

  • 设置了一个CronR作业来定期运行它。

checkEmail <- function(searchString="from: X@example.com Test: New Order",minutesThreshold=20){ searchResults<- messages(searchString) %>% unlist(.,recursive = FALSE) cat( paste0( searchResults$resultSizeEstimate,“results found for ",searchString,"\n")) #extract bookings searchResultsDf <- dplyr::bind_rows(searchResults$messages) selectid <- vector() for(i in 1:nrow(searchResultsDf)){ #获取个人ID id <- searchResultsDf$idi #提取消息resultMessage <- message(id,timeReceived = "full") #获取接收消息的时间%>% as.numeric() %>% /(1000) %>% as.POSIXct(origin= "1970-01-01") cat(paste0("Message received at ",timeReceived," \n") ) #如果是很久以前的事,请忽略if( (timeReceived) < (Sys.time()-minutesThreshold*60) ){ cat(“找不到最近的消息\n”) break }else{ timeReceived if <- id }}return(Sys.time) }

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51866048

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档