不要在 Shiny 中的电子邮件正文中显示反应对象中的任何文本或错误

Don't show any text or error in reactive object in body of the email in Shiny

我想发送一封电子邮件(此时使用 blastula 包),邮件正文是一个反应对象 (MyMSG()) 创建于:

MyMSG <- reactive({

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

})

但是无法成功导出电子邮件正文中 textAreaInput 中的文本。在我的例子中:

observeEvent(input$sendMSG, {
  
  output$sendMSG <- MyMSG() 
    my_email_object<- 
    compose_email(
      body = c(MyMSG())
    )

但是消息正文是空的,或者如果我更改了某些内容(例如 as.vector(MyMSG())readLines(MyMSG()))“writeImpl 中的错误:要写入的文本必须是长度为一的字符" 错误。

请问有什么解决办法吗?

这个:

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

不正确。简单做

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

对于您的观察者:

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