从Shiny发送附件

Lit*_*tle 5 email smtp r shiny shiny-server

我使用Shiny创建了一个应用程序并上传到属于shinyapps.io的服务器; 我测试过,一切都很好.我的应用程序通过server.R创建一个文本文件,我想在用户完成任务时发送到我的电子邮件.我想将该文件发送到我的电子邮件,因为我没有看到在shinyapps.io管理工具中查看我的闪亮应用程序输出的文件的方法.那么底线,如何将文件从闪亮的应用程序发送到我的电子邮件?

例如,如果我有以下内容:

library(sendmailR)
datos<-read.table("data.txt")
to <- "<loretta@gmail.com>"
subject <- "Email Subject"
body <- "Email body."                     
mailControl=list(smtpServer="ASPMX.L.GOOGLE.COM")
sendmail(from="localhost",to=to,subject=subject,msg=body,control=mailControl)
attachmentObject <- mime_part(name=datos)
bodyWithAttachment <- list(body,attachmentObject)
sendmail(from="localhost",to=to,subject=subject,msg=bodyWithAttachment,control=mailControl)
Run Code Online (Sandbox Code Playgroud)

我想知道我应该放什么一部分,我的意思是我已经把它本地主机,但我需要把其中的闪亮运行应用程序的地址; 从哪里可以得到它?

此外,当我运行上面的代码,而不是在Shiny环境中,但作为脚本,我在sendmail部分后得到以下错误:

Error in wait_for(code) : 
  SMTP Error: 5.5.2 Syntax error. g22si4860678yhc.87 - gsmtp
Run Code Online (Sandbox Code Playgroud)

任何帮助都会很棒

Ran*_*ahn 0

这适用于我使用mailR库从 Outlook 发送电子邮件:

library(mailR)

bodyMsg <- "Some message to be included in the body of the email"

send.mail(from = "sender@xyz.com", to = "receiver@xyz.com",  subject = "Some topic",
              body = bodyMsg ,  authenticate = TRUE, html = TRUE, send = TRUE, attach.files = file.path(folder, fileName),
              smtp = list(host.name = "abcdef.xyz.com", port = 587, user.name = "sender@xyz.com", passwd = "password", tls = TRUE))}
Run Code Online (Sandbox Code Playgroud)