I am trying to send an email from RStudio using the mailR and gmail package. The following is my code ...
library(mailR) sender <- " xxxxx@gmail.com " recipients <- c(" xxxxx@gmail.com ") send.mail(from = sender, to = recipients, subject = "Test mail from Rstudio", body = "Test email body", smtp = list(host.name = "smtp.gmail.com", port = 465, user.name = " xxxxx@gmail.com ", passwd = "******", ssl = TRUE), authenticate = TRUE, send = TRUE)
The following error message appears ...
org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.gmail.com:465 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(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at RJavaTools.invokeMethod(RJavaTools.java:386) Caused by: javax.mail.AuthenticationFailedException: 534-5.7.14 <https:
What exactly am I doing wrong here? The google link mentioned in the error message does not exist.
EDIT: Received an email from Google saying: "Login error: someone tried to enter the application from an application that does not meet modern security standards ..."
Is there any way around this? Google's email says nothing about letting me send messages from R.
source share