我一直在R中使用gmailR来从R发送电子邮件而没有问题,但是自从一周以来,它一直出现故障。有时它可以工作,但大多数时候却不行。这是来自github的Trinker包(不是CRAN gmailr!):https://github.com/trinker/gmailR

这是我的脚本:

library(gmailR)
chartime <- as.character(Sys.time())
email_test <- function(chartime){
  gmail("[email protected]", password="************", subject = "Test No New Projects",
        message = paste("Testing time at",chartime), from = "[email protected]",
        attachment = NULL, server = "smtp.gmail.com:587", username = "[email protected]",
        confirmBeforeSend = FALSE, clear.username = FALSE)}
email_test(chartime)


这是错误:

Error in jython.exec(rJython, mail) :
  Only AF_INET sockets are currently supported on jython
7 stop(python.exception)
6 jython.exec(rJython, mail)
5 email.helper(to = list(to[i]), from = list(from), subject = subject,
    message = message, attachment = atts[[i]], username = username,
    password = password, server = server, confirmBeforeSend = confirmBeforeSend)
4 FUN(1L[[1L]], ...)
3 lapply(seq_along(to), function(i) {
    email.helper(to = list(to[i]), from = list(from), subject = subject,
        message = message, attachment = atts[[i]], username = username,
        password = password, server = server, confirmBeforeSend = confirmBeforeSend) ...
2 gmail("[email protected]", password = "**********", subject = "Test No New Projects",
    message = paste("Testing time at", chartime), from = "[email protected]",
    attachment = NULL, server = "smtp.gmail.com:587", username = "[email protected]",
    confirmBeforeSend = FALSE, clear.username = FALSE)
1 email_test(chartime)


这是我的会话信息:

   R version 3.1.3 (2015-03-09)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.5 (Yosemite)

locale:
[1] nl_NL.UTF-8/nl_NL.UTF-8/nl_NL.UTF-8/C/nl_NL.UTF-8/nl_NL.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] gmailR_1.0    rJython_0.0-4 rjson_0.2.15  rJava_0.9-7

loaded via a namespace (and not attached):
[1] tools_3.1.3  XML_3.98-1.3


我怎样才能解决这个问题?

最佳答案

Jython 2.5.2已修复为不支持AF_INET6的问题,请参见http://bugs.jython.org/issue1210(事实是您的问题出现在另一个路由器上,这实际上表明它是IPv4 vs IPv6。)但是,rJython捆绑了Jython jar的较旧版本。也许可以升级,即使不能升级到2.7?

可能值得联系rJython软件包的维护者来这样做。

07-24 09:45