issue using sendemailR [duplicate]

隐身守侯 提交于 2019-11-29 12:21:58
alko989

There are two things that need attention in your example:

As @David Arenburg commented, to should contain a valid email address.

The second thing is the smtp server you are using: smtp.gmail.com. This server need authentication which is not supported by sendmailR.

You can use an smtp server that does not require authentication (e.g. the restricted gmail smtp server: aspmx.l.google.com, port 25, see here for details)

The other option is to use the mailR package that allows authentication.

Try something like (of course you have to put valid email addresses and user.name and passwd to work):

library(mailR)
sender <- "SENDER@gmail.com"
recipients <- c("RECIPIENT@gmail.com")
send.mail(from = sender,
to = recipients,
subject="Subject of the email",
body = "Body of the email",
smtp = list(host.name = "smtp.gmail.com", port = 465, 
        user.name="YOURUSERNAME@gmail.com", passwd="YOURPASSWORD", ssl=TRUE),
authenticate = TRUE,
send = TRUE)

Hope it helps,

alex

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!