This package builds on the gmailr package and code from Jenny Bryan to automate sending Gmail from R with data from a spreadsheet (local csv, Excel sheet, or a Google sheet). With nothing more than a list of names and email addresses, you can send templated emails (grades, conference acceptances etc)

Install

# Obtain the the development version from GitHub:
# install.packages("devtools")
devtools::install_github("ropenscilabs/ponyexpress")

Functionality

Example

1. Read in data frame

 df <- data.frame(
    name = c("Lucy", "Karthik"),
    email = c("[email protected]", "[email protected]")
  )
  df

2. Template up

library(ponyexpress)
template <- "Dear {name},

   This is a friendly email from me.

  XO,
   Lucy"

 # Or write a rich template!

rich_template <- "Dear {name},

   This is a friendly email from me.
  \\<img src='http://bukk.it/wut.jpg'>
   XO,
   Lucy"

 # Or use one of our templates!
 # Save your text as an object named "body"
 # then use glue!
body <- "Dear {name},

   This is a friendly email from me.
  \\<img src='http://bukk.it/wut.jpg'>
   XO,
   Lucy"
our_template <- glue::glue(glitter_template)

3. Parcel & Preview

  parcel <- parcel_create(df,
              sender_name = "Lucy",
              sender_email = "[email protected]",
              subject = "Happy email!",
              template = rich_template)

 parcel_preview(parcel)

4. Send

parcel_send(parcel)