Last active
March 30, 2018 00:02
-
-
Save daattali/df4d2dbb0eb7199ac138 to your computer and use it in GitHub Desktop.
Send a text message via email from R
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(shiny) | |
library(gmailr) | |
ui <- fluidPage( | |
textInput("subj", "Subject", "Schedule change"), | |
textInput("text", "Message"), | |
actionButton("btn", "Send") | |
) | |
server <- function(input, output, session) { | |
observeEvent(input$btn, { | |
test_email <- mime() %>% | |
to(c("[email protected]", "[email protected]")) %>% | |
html_body(input$text) %>% | |
subject(input$subj) | |
# attach_file("file.txt") | |
test_email <- sub("Content-Disposition: inline\r\n--","Content-Disposition: inline\r\n\r\n--", as.character(test_email)) | |
ret_val <- send_message(test_email) | |
}) | |
} | |
shinyApp(ui = ui, server = server) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment