Skip to content

Instantly share code, notes, and snippets.

@smithjd
Last active July 19, 2023 00:14
Show Gist options
  • Select an option

  • Save smithjd/93d95abc8f84f7ddedf5c45c63839044 to your computer and use it in GitHub Desktop.

Select an option

Save smithjd/93d95abc8f84f7ddedf5c45c63839044 to your computer and use it in GitHub Desktop.
Send various kinds of emails using gmailr
library(tidyverse)
library(gmailr)
gm_auth_configure()
prepare_and_send <- function(sender, recipient, title, text) {
email <- gmailr::gm_mime() %>%
gmailr::gm_to(recipient) %>%
gmailr::gm_from(sender) %>%
gmailr::gm_subject(title) %>%
gmailr::gm_html_body(text)
email |>
gmailr::gm_send_message()
}
prepare_and_send("my-address", "joe <joe@gmail.com>, jane <jane@gmail.com>", "Testing gmailr", "This is <b>JUST</b> a test" )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment