Last active
July 19, 2023 00:14
-
-
Save smithjd/93d95abc8f84f7ddedf5c45c63839044 to your computer and use it in GitHub Desktop.
Send various kinds of emails using gmailr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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