I am using mailR
package to send an email through R
I am using following code
send.mail(from = "xyz@gmail.com",
to = c("abc@hotmail.com"),
#replyTo = c("Reply to someone else <someone.else@gmail.com>")
subject = "Hi",
body = "Hi",
smtp = list(host.name = "smtp.gmail.com", port = 465, user.name = "xyz", passwd = "", ssl = TRUE),
authenticate = TRUE,
send = TRUE)
When I run this code I get following error.
Error: EmailException (Java): Sending the email to the following server failed : smtp.gmail.com:465 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(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at RJavaTools.invokeMethod(RJavaTools.java:386) Caused by: javax.mail.AuthenticationFailedException: 534-5.7.14 Please log in via your web browser and 534-5.7.14 then try again. 534-5.7.14 Learn more at 534 5.7.14 https://support.google.com/mail/answer/78754 191sm1808499pfx.68 - gsmtp
at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:892) at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:814) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:728) at javax.mail.Service.connect(Service.java:386) at javax.mail.Service.connect(Service.java:245) at javax.mail.Service.connect(Service.java:194) at javax.mail.Transport.send0(Transport.java:253) at javax.mail.Transport.send(Transport.java:124) at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1400) ... 6 more
Is it because of some security reasons gmail is blocking the access? How do I get rid of it?