gmailr v0.7.1

0

Monthly downloads

0th

Percentile

Access the Gmail RESTful API

An interface to the Gmail RESTful API. Allows access to your Gmail messages, threads, drafts and labels.

Readme

gmailr

Build Status Coverage Status

Exposing the Gmail API from R.

Features

  • 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")
  • Create and send emails and drafts: see sending_messages vignette
  • 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)
  • take things out of the gmail trash
    • messages: untrash_message(message_id)
    • threads: untrash_thread(thread_id)
  • delete directly without using the trash
    • messages: delete_message(message_id)
    • threads: delete_thread(thread_id)

Setup

By default gmailr will use a global project. However if you are going to be doing a heavy user and will do a lot of queries please setup your own project with the steps below.

  • Register a new project at https://console.cloud.google.com
  • Navigate to APIs
    • Switch the Gmail API status to On, and other API status to Off
  • Navigate to APIs & auth->Consent screen
    • Name your application
    • Select an email address for the application
    • Other fields can be left blank
  • Navigate to APIs & auth->Credentials
    • Create a new client ID
      • Application Type: Installed Application
      • Installed Application Type: Other
    • Download the Client ID JSON - can be renamed!
  • Use the downloaded JSON file as input to gmail_auth()

    ```R
    gmail_auth('file.json')
    ```
    

Future Work

  • More unit tests and better coverage
  • More (complicated) examples
  • Email statistics
  • Programmatic emailing
  • Returning data frames in addition to native Gmail API objects which are usually a nested list.
  • Support all the formats of users.messages:get

Examples

Functions in gmailr

Name Description
create_label Create a new label
clear_token Clear the current oauth token
mime Create a mime formatted message object
create_draft Create a draft from a mime message
trash_message Send a single message to the trash
save_attachments Save attachments to a message
quoted_printable_encode Encode text using quoted printable
drafts Get a list of drafts
insert_message Insert a message into the gmail mailbox from a mime message
labels Get a list of all labels
body Get the body text of a message or draft
delete_thread Permanently delete a single thread.
trash_thread Send a single thread to the trash
threads Get a list of threads
delete_label Permanently delete a label
send_message Send a message from a mime message
use_secret_file Use information from a secret file
save_attachment save the attachment to a file
history Retrieve change history for the inbox
id Get the id of a gmailr object
gmailr gmailr makes gmail access easy.
to Methods to get values from message or drafts
thread Get a single thread
untrash_message Remove a single message from the trash
messages Get a list of messages
message Get a single message
modify_thread Modify the labels on a thread
%>% Pipe statements
import_message Import a message into the gmail mailbox from a mime message
label Get a specific label
attachment Retrieve an attachment to a message
gmail_auth Setup oauth authentication for your gmail
as.character.mime Convert a mime object to character representation
untrash_thread Remove a single thread from the trash.
delete_message Permanently delete a single message
draft Get a single draft
update_label Update a existing label.
send_draft Send a draft
last_response Response from the last query
modify_message Modify the labels on a message
%>% Pipe statements
No Results!

Vignettes of gmailr

Name
sending_messages.Rmd
sending_messages.md
No Results!

Last month downloads

Details

License MIT + file LICENSE
URL https://github.com/jimhester/gmailr
BugReports https://github.com/jimhester/gmailr/issues
VignetteBuilder knitr
RoxygenNote 5.0.1
NeedsCompilation no
Packaged 2016-04-11 21:12:00 UTC; jhester
Repository CRAN
Date/Publication 2016-04-12 01:02:42

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/gmailr)](http://www.rdocumentation.org/packages/gmailr)