imapr
performs IMAP queries via curl.
master
develop
require("devtools")
install_github("crazycapivara/imapr")
library(imapr)
host <- "imaps://imap.gmail.com"
imap <- IMAP(host) %>% user("your_username", "your_password")
imap[c("url", "path")]
## $url
## [1] "imaps://imap.gmail.com"
##
## $path
## [1] ""
response <- imap %>% LIST() %>% execute()
response %>% cat()
## * LIST (\HasNoChildren) "/" "INBOX"
## * LIST (\HasChildren \Noselect) "/" "[Gmail]"
## * LIST (\All \HasNoChildren) "/" "[Gmail]/Alle Nachrichten"
## * LIST (\Drafts \HasNoChildren) "/" "[Gmail]/Entw&APw-rfe"
## * LIST (\HasNoChildren \Sent) "/" "[Gmail]/Gesendet"
## * LIST (\Flagged \HasNoChildren) "/" "[Gmail]/Markiert"
## * LIST (\HasNoChildren \Trash) "/" "[Gmail]/Papierkorb"
## * LIST (\HasNoChildren \Junk) "/" "[Gmail]/Spam"
## * LIST (\HasNoChildren \Important) "/" "[Gmail]/Wichtig"
imap %>% SELECT("INBOX") %>% .[c("url", "path")]
## $url
## [1] "imaps://imap.gmail.com"
##
## $path
## [1] "INBOX"
search_all <- imap %>% SELECT("INBOX")
%>% SEARCH("ALL") %>% execute()
search_all %>% substr(1, 20)
## [1] "* SEARCH 1 2 3 4 5 6"
## attr(,"url")
## [1] "imaps://imap.gmail.com/INBOX"
header <- imap %>% SELECT("INBOX") %>%
FETCH(1, sections("header_min")) %>% execute()
header %>% cat()
## From: Travis CI <builds@stuff.hi>
## Subject: Failed: crazycapivara/owmr#35 (bleeding-edge - fd15c7d)
## To: <coughing@cohen.salut>
## Date: Sat, 17 Dec 2016 14:39:40 +0000
##
## To be continued ##
devtools::test(reporter = "tap")
## Loading imapr
## Loading required package: testthat
## Testing imapr
## 1..5
## # Context imap
## ok 1 init
## ok 2 init
## # Context SEARCH
## ok 3 by flags
## ok 4 by flags
## # Context SELECT
## ok 5 escape mailbox name with brackets
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.