gpt4 book ai didi

r - 在 OSX 上通过 R 解决方法发送 Outlook 电子邮件

转载 作者:行者123 更新时间:2023-12-05 06:35:40 25 4
gpt4 key购买 nike

我浏览了整个网站,但未能找到答案。

我需要使用 R 通过我的作品 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?

它导致了这个错误:

org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp-mail.outlook.com:25 at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1410) at org.apache.commons.mail.Email.send(Email.java:1437) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at RJavaTools.invokeMethod(RJavaTools.java:386) Caused by: com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM [BN6PR19CA0117.namprd19.prod.outlook.com]

at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:2202) at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1693) at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1194) at javax.mail.Transport.send0(Transport.jaNULL va:254) at javax.mail.Transport.send(Transport.java:124) at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1400) ... 6 more Error: EmailException (Java): Sending the email to the following server failed : smtp-mail.outlook.com:25

最佳答案

因此,您不必通过 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)

关于r - 在 OSX 上通过 R 解决方法发送 Outlook 电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49640799/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com