Getting the error while sending the mailR package from R

2291 views r
5

with continuing thread link i have tried to send the sample mail from college system but fails in r to send also getting the below error.

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:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at RJavaTools.invokeMethod(RJavaTools.java:386)
Caused by: javax.mail.AuthenticationFailedException: 534-5.7.9 Application-specific password required. Learn more at
534 5.7.9  https://support.google.com/mail/?p=InvalidSecondFactor p87-v6sm20894169pfk.186 - 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)
NULL
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
EmailException (Java): Sending the email to the following server failed : smtp.gmail.com:465[1] "Java-Object{org.apache.commons.mail.ImageHtmlEmail@58ceff1}"

how to fix the error and please help me to send the mail using r?

answered question

1 Answer

10

problem might be at 2 levels

first check the mail using to sent like u will get any messages like warning messages from google as your account is trying to access some miscellaneous apps or like that... if u got message then nothing problem at R side

so your next step is to check from google end

use link to enable low secure apps in google

please enable low secure apps turn ON and try again.

Note : first check java is properly linked or not and working properly or not in R (test with run of library(rJava)) if it run successfully java is perfectly enabled with proper path, otherwise need to set the proper java home path according to the Operating System.

posted this

Have an answer?

JD

Please login first before posting an answer.