Easily exposing the Gmail API from R.
- retrieve data from your email
- drafts:
my_drafts = drafts()
- history:
my_history = history(start_num)
- labels:
my_labels = labels()
- messages:
my_messages = messages("search query")
- threads:
my_threads = threads("search query")
- drafts:
- manage email labels programmatically:
modify_thread(thread_id, add_labels=c("label_1"), remove_labels=c("label_2"))
- put things in the gmail trash
- messages:
trash_message(message_id)
- threads:
trash_thread(thread_id)
- messages:
- take things out of the gmail trash
- messages:
untrash_message(message_id)
- threads:
untrash_thread(thread_id)
- messages:
- delete directly without using the trash
- messages:
delete_message(message_id)
- threads:
delete_thread(thread_id)
- messages:
Register an application at https://cloud.google.com/console#/project
-
create a new client ID (choose 'installed applications') and download the resulting JSON
-
authorize the application using
gmail_auth()
gmail_auth('file.json')