这是我写的闪亮电子邮件发送器来测试sendmailR
打包在一个闪亮的应用程序中。在 Linux 平台上,我没有配置任何东西,应用程序完美运行。用户在由生成和处理的文本区域中键入消息正文shinyAce
包裹。
ui.R
shinyUI(pageWithSidebar(
headerPanel("Email sender"),
sidebarPanel(
textInput("from", "From:", value="[email protected] /cdn-cgi/l/email-protection"),
textInput("to", "To:", value="[email protected] /cdn-cgi/l/email-protection"),
textInput("subject", "Subject:", value=""),
actionButton("send", "Send mail")
),
mainPanel(
aceEditor("message", value="write message here")
)
))
server.R
library(shinyAce)
library(sendmailR)
shinyServer(function(input, output, session) {
observe({
if(is.null(input$send) || input$send==0) return(NULL)
from <- isolate(input$from)
to <- isolate(input$to)
subject <- isolate(input$subject)
msg <- isolate(input$message)
sendmail(from, to, subject, msg)
})
})