通过OSX上的R解决方案发送Outlook电子邮件

通过OSX上的R解决方案发送Outlook电子邮件,r,rstudio,rdcomclient,R,Rstudio,Rdcomclient,我浏览了整个网站,但没有找到答案 我需要使用R通过我的works outlook电子邮件发送电子邮件。它必须来自Outlook,而不是其他任何地方 问题是,我使用的计算机是OSX,所以RDCOMClient无法工作 编辑:尝试过这个,但它不起作用 sender<-"myemail@outlook.com" recipients<-c("myemail@outlook.com") send.mail(from = sender, to = recipients, s

我浏览了整个网站,但没有找到答案

我需要使用R通过我的works outlook电子邮件发送电子邮件。它必须来自Outlook,而不是其他任何地方

问题是,我使用的计算机是OSX,所以
RDCOMClient
无法工作

编辑:尝试过这个,但它不起作用

sender<-"myemail@outlook.com"
recipients<-c("myemail@outlook.com")
send.mail(from = sender, to = recipients,
          subject = "Test",
          body = BodyOfMessage,
          smtp = list(host.name = "smtp-mail.outlook.com"),
          authenticate = FALSE,
          html = TRUE,
          send = TRUE)Does anyone have a workaround? 

sender因此,您不必通过Outlook客户端发送此邮件,Outlook就是这样。您可能希望允许您编写的R脚本和所使用的库成为电子邮件客户端。我使用mailR取得了很大的成功。有些人喜欢sendmailR发送消息。它们都有各自的优势。如果您在主机上运行大量脚本,您的电子邮件管理员可能会允许未经验证的发送。或者您可以在脚本中进行身份验证。
例如:

library(mailR)
#################
# Generate Spam #
#################
BodyOfMessage <- paste("<html><body><p>Hello,</p><p>This is an email message.</p>
                      <hr>
                      <p>The second table is a list of users that need to be toggled in the system, by adding them to the correct securitygroup.</p>
                      <p>", toggle.these.people, "</p>
                      <p>Scott</p></body></html>")
#mailR
    sender<-"fromwho@fromyou.org"
    recipients<-c("emailtosendto@email.com")
    send.mail(from = sender, to = recipients,
    subject = paste("Blah. Created: today.", sep = ""),
    body = BodyOfMessage,
    smtp = list(host.name = "smtp.exchangeserver.org"),
    authenticate = FALSE,
    html = TRUE,
    attach.files = CSVFileNameIs,    
    send = TRUE)
库(mailR)
#################
#生成垃圾邮件#
#################

BodyOfMessage这是我使用的,对我来说很好用

library(RDCOMClient)
## init com api
OutApp <- COMCreate("Outlook.Application")
## create an email 
outMail = OutApp$CreateItem(0)
## configure  email parameter 
outMail[["To"]] = "ryanshuell@gmail.com"
outMail[["subject"]] = "some subject"
outMail[["body"]] = "some body"
## send it                     
outMail$Send()
库(RDCOMClient)
##初始化com api

谢谢你。您所说的
是什么意思?您希望允许您编写的R脚本和所使用的库成为电子邮件客户端
?没问题。不要使用Outlook之类的邮件客户端,而是让R脚本和库作为客户端。mailR或sendmailR包(其他包也存在)作为客户端与服务器进行协商。您的脚本提供了正确的参数,例如smtp地址、邮件、主题、发件人、收件人、凭据……谢谢。我只是用你给我的东西在我原来的帖子里贴了一些改动。我想我只需要更改我的身份验证权限?有几个经过身份验证的发送示例。根据此消息,身份验证是一个问题,因此可以在脚本中进行身份验证,或者让邮件管理员允许从某些主机进行未经身份验证的发送。