rstudio / blastula

Easily send great-looking HTML email messages from R
https://pkgs.rstudio.com/blastula
Other
546 stars 84 forks source link

Don't show or error in reactive object in body of the message in Shiny #264

Closed Leprechault closed 3 years ago

Leprechault commented 3 years ago

Hi Everyone!!

I'd like to send an email and the body of the message is a reactive object (MyMSG()) create in:

    MyMSG <- reactive({

    output$text_output <- renderText({input$text_input})

    })

But a don't have success in export the text inside my textAreaInput inside the email body. In my example:

    observeEvent(input$sendMSG, {

      output$sendMSG <- MyMSG() 
        my_email_object<- 
        compose_email(
          body = c("Evento em:",
                     currentvariable4(),
                   MyMSG())
        )

But the body of the message is empty or if I change something (eg. as.vector(MyMSG()) or readLines(MyMSG())) an "Error in writeImpl: Text to be written must be a length-one character" error.

Please, any ideas to solve it?

Leprechault commented 3 years ago

his:

MyMSG <- reactive({
  output$text_output <- renderText({input$text_input})
})

is not correct. Simply do

output$text_output <- renderText({input$text_input})

And for your observer:

observeEvent(input$sendMSG, {
  my_email_object <- 
    compose_email(
      body = input$text_input
    )