gpt4 book ai didi

r - 在 Windows 中使用 sendmailR

转载 作者:行者123 更新时间:2023-12-02 10:25:25 24 4
gpt4 key购买 nike

我尝试使用以下代码在 Windows 上运行 sendmailR:

## Not run: 
from <- "<tal.galili@gmail.com>" # sprintf("<sendmailR@\\%s>", Sys.info()[4])
to <- "<tal.galili@gmail.com>"
subject <- "Hello from R"
body <- list("It works!", mime_part(iris))
sendmail(from, to, subject, body,
control=list(smtpServer="ASPMX.L.GOOGLE.COM."))

并出现以下错误:

Error in socketConnection(host = server, port = port, blocking = TRUE) : 
cannot open the connection
In addition: Warning message:
In socketConnection(host = server, port = port, blocking = TRUE) :
smtp.gmail.com tal.galili@gmail.com:statisfun:25 cannot be opened

The answer here给出一个针对 Linux 的解决方案,对于 Windows 用户的建议,我将不胜感激。

谢谢。

最佳答案

您可以尝试一下新的 mailR 包:http://cran.r-project.org/web/packages/mailR/index.html

下面的调用应该可以工作:

send.mail(from = "tal.galili@gmail.com",
to = "tal.galili@gmail.com",
subject = "Subject of the email",
body = "Body of the email",
smtp = list(host.name = "smtp.gmail.com", port = 465, user.name = "tal.galili", passwd = "PASSWORD", ssl = TRUE),
authenticate = TRUE,
send = TRUE)

关于r - 在 Windows 中使用 sendmailR,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15421130/

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