在系统中没有 Outlook 应用程序的情况下在 R 中发送电子邮件

问题描述

我可以使用以下代码发送电子邮件

chrome.storage.local.QUOTA_BYTES

然而,我没有安装outlook,在服务器机器上但仍然需要发送电子邮件

我可以使用 Python 中的 ma​​iler 包实现相同的功能,在 R 中实现相同功能的最佳方法是什么。

谢谢

解决方法

在 R 中实现的任何 SMTP 客户端都可以完成这项工作。 看看这个:Rmailer

来自他们的例子:

library(Rmailer)


message <- c(
  "Hey,","","I have a nice pic for you!","Best","C."
)


settings <- list(
  server = "smtp.example.org",username = "user",password = "password"
)


## send message:
sendmail(
  from = "[email protected]",to = "[email protected]",subject = "Good news!",msg = message,smtpsettings = settings,attachment = "nice_pic.jpg"
)
,

解决了问题,使用mailR包,效果很好。

library(mailR)
send.mail(from = "[email protected]",to = "[email protected]",subject = subjectToSend,body = bodyToSend,html = TRUE,smtp = list(host.name = "smtp.company.com",port = 25),send = TRUE)