Rshiny中的电子邮件问题::从Shinyapps.io以pdf/.html格式附加数据框 [![i=iris 图书馆(闪亮) 图书馆(邮递) ui=fluidPage( fluidRow( div(id=“login”, wellPanel(title

Rshiny中的电子邮件问题::从Shinyapps.io以pdf/.html格式附加数据框 [![i=iris 图书馆(闪亮) 图书馆(邮递) ui=fluidPage( fluidRow( div(id=“login”, wellPanel(title,shiny,shiny-server,shinydashboard,Shiny,Shiny Server,Shinydashboard,Rshiny中的电子邮件问题::从Shinyapps.io以pdf/.html格式附加数据框 [![i=iris 图书馆(闪亮) 图书馆(邮递) ui=fluidPage( fluidRow( div(id=“login”, wellPanel(title=“邮寄您的报告”, textInput(“to”,label=“to:”,placeholder=“to:”), 文本输入(“子”,“主题:”), 文本输入(“消息”,“消息:”), actionButton(“邮件按钮”,label=“发送

Rshiny中的电子邮件问题::从Shinyapps.io以pdf/.html格式附加数据框
[![i=iris
图书馆(闪亮)
图书馆(邮递)
ui=fluidPage(
fluidRow(
div(id=“login”,
wellPanel(title=“邮寄您的报告”,
textInput(“to”,label=“to:”,placeholder=“to:”),
文本输入(“子”,“主题:”),
文本输入(“消息”,“消息:”),
actionButton(“邮件按钮”,label=“发送邮件”)
)
),tableOutput(outputId=“fo”)
)
)
服务器=功能(输入、输出、会话){
ObserveeEvent(输入$mailButton{
隔离({
send.mail(from=“******@gmail.com”,
to=unlist(strsplit(输入$to,;”,fixed=TRUE)),
主题=输入$sub,
body=输入$msg,
smtp=list(host.name=“smtp.gmail.com”,port=465,user.name=“******@gmail.com”,passwd=“*******”,ssl=TRUE),
验证=真,
attach.files=“fo”,html=TRUE,
发送=真)
})
})
输出$fo
i=iris
图书馆(闪亮)
图书馆(邮递)

A您应该将代码作为文本发布,以便其他用户可以测试代码。@JakeConway您所说的文本是什么意思。代码已经是这种形式了only@Veerendra没有问题,先生,我已经上传了代码,幸运的是我也得到了解决方案。所以感谢您的评论这是解决方案,完全有效!!!!只要确保您正在使用的目录!!
[![i=iris
library(shiny)
library(mailR)

ui =fluidPage(

  fluidRow(
    div(id = "login",
        wellPanel(title = "Mail your report", 
                  textInput("to", label = "To:", placeholder = "To:"),
                  textInput("sub","Subject:"),
                  textInput("msg","Message:"),
                  actionButton("mailButton",label = "Send mail") 
        )
    ),tableOutput(outputId = "fo")
    )
)
server = function(input, output, session) {

  observeEvent(input$mailButton,{
    isolate({
      send.mail(from = "*****@gmail.com",
                to = unlist(strsplit(input$to, ";", fixed = TRUE)),
                subject = input$sub,
                body = input$msg,
                smtp = list(host.name = "smtp.gmail.com", port = 465, user.name = "****@gmail.com", passwd = "******", ssl = TRUE),
                authenticate = TRUE,
                attach.files = "fo",html = TRUE,
                send = TRUE)
    })
  })

  output$fo <- renderTable({ 
    a<- as.data.frame(iris)
    a$new <- a$Sepal.Length+a$Sepal.Width
    a

  })
}
runApp(list(ui=ui,server=server))  ][1]][1]
    i=iris
library(shiny)
library(mailR)

a<- as.data.frame(iris)
write.csv(a,file="test.csv")
ui =fluidPage(

  fluidRow(
    div(id = "login",
        wellPanel(title = "Mail your report", 
                  textInput("to", label = "To:", placeholder = "To:"),
                  textInput("sub","Subject:"),
                  textInput("msg","Message:"),
                  actionButton("mailButton",label = "Send mail") 
        )
    ),tableOutput(outputId = "fo")
    )
)
server = function(input, output, session) {

  observeEvent(input$mailButton,{
    isolate({
      send.mail(from = "****@gmail.com",
                to = unlist(strsplit(input$to, ";", fixed = TRUE)),
                subject = input$sub,
                body = input$msg,
                smtp = list(host.name = "smtp.gmail.com", port = 465, user.name = "****@gmail.com", passwd = "nbwishes", ssl = TRUE),
                authenticate = TRUE,
                attach.files = "test1.csv",html = TRUE,
                send = TRUE)
    })
  })

  output$fo <- renderTable({ 
    a<- as.data.frame(iris)
    a$new <- a$Sepal.Length+a$Sepal.Width
    write.csv(a,file="test1.csv")

  })
}
runApp(list(ui=ui,server=server))