我想按固定主题的特定电子邮件定期搜索我的gmail收件箱。有人知道我怎样才能自动执行这个搜索吗?我正在使用gmailr包。任何想法都将不胜感激。
致以最好的问候,海伦
发布于 2018-11-14 17:00:58
我找到了一个使用AWS的解决方案。我在detail here上写了这篇文章。
简而言之,您需要做的是:
亚马逊网络服务设置了一个instance.
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) }
https://stackoverflow.com/questions/51866048
复制相似问题