[SOLVED] Mail action error

Tags: #<Tag:0x00007f617eb27be0>

Continuing the discussion from Help with mail action gmail error Could not send e-mail (SOLVED):

Hi everyone.I tried everything you’ve suggested above. Still getting an error.
A mail has to be sent when a device connects to the network my RPi is connected to.

2018-12-12 16:30:00.852 [INFO ] [pse.smarthome.model.script.Test Mail] - Sending Mail

2018-12-12 16:30:02.249 [ERROR] [rg.openhab.action.mail.internal.Mail] - Could not send e-mail to '********

your code goes here

@gmail.com’.

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:1421) ~[?:?]

at org.apache.commons.mail.Email.send(Email.java:1448) ~[?:?]

at org.openhab.action.mail.internal.Mail.sendMail(Mail.java:157) ~[?:?]

at org.openhab.action.mail.internal.Mail.sendMail(Mail.java:89) ~[?:?]

at org.openhab.action.mail.internal.Mail.sendMail(Mail.java:67) ~[?:?]

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 org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeOperation(XbaseInterpreter.java:1085) ~[?:?]

at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeOperation(XbaseInterpreter.java:1060) ~[?:?]

at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._invokeFeature(XbaseInterpreter.java:1046) ~[?:?]

at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeFeature(XbaseInterpreter.java:991) ~[?:?]

at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:143) ~[?:?]

at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:901) ~[?:?]

at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:864) ~[?:?]

at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:223) ~[?:?]

at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:219) ~[?:?]

at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:203) ~[?:?]

at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:446) ~[?:?]

at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:227) ~[?:?]

at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:219) ~[?:?]

at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:203) ~[?:?]

at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluate(XbaseInterpreter.java:189) ~[?:?]

at org.eclipse.smarthome.model.script.runtime.internal.engine.ScriptImpl.execute(ScriptImpl.java:82) ~[?:?]

at org.eclipse.smarthome.model.rule.runtime.internal.engine.RuleEngineImpl.lambda$2(RuleEngineImpl.java:345) ~[?:?]

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]

at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?]

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:?]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]

at java.lang.Thread.run(Thread.java:748) [?:?]

Caused by: javax.mail.AuthenticationFailedException: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbv8

534-5.7.14 LA5pNZBH3B3gNYYUd5xDLD4CzSMThsEiJZTBaTh_0vKjqx2386IKT5XKfBzbe5K21B3Fe9

534-5.7.14 cq7b25L97ZtMEYuCBlN9lrHvRKetpUs9nTc0U4FzxfUerCbFdhti-deun9JBHkb1oY5ZD3

534-5.7.14 IM00-1HbtktmxBOvIFQXwITSnm2ksZ1WHdArnTF8vcpRLatkmGIWZslfk_I3nU3dl5AoG8

534-5.7.14 wSXQnXS2DsPvRVKRBP9kmxRw7xglG0YV2_yCfXm7guKmaitJ62> Please log in via

534-5.7.14 your web browser and then try again.

534-5.7.14 Learn more at

534 5.7.14 https://support.google.com/mail/answer/78754 g190sm19785692pgc.28 - gsmtp

at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:809) ~[29:javax.mail:1.4.4]

at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:752) ~[29:javax.mail:1.4.4]

at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:669) ~[29:javax.mail:1.4.4]

at javax.mail.Service.connect(Service.java:317) ~[29:javax.mail:1.4.4]

at javax.mail.Service.connect(Service.java:176) ~[29:javax.mail:1.4.4]

at javax.mail.Service.connect(Service.java:125) ~[29:javax.mail:1.4.4]

at javax.mail.Transport.send0(Transport.java:194) ~[29:javax.mail:1.4.4]

at javax.mail.Transport.send(Transport.java:124) ~[29:javax.mail:1.4.4]

at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1411) ~[?:?]

My rules file

rule “Send E-mail”
when
Item Status_Mobile_***** changed from OFF to ON
then
logInfo(“Test Mail”, “Sending Mail” )
sendMail("********@gmail.com", “Test”, “Mobile Connected”)
end

Any help is appreciated.

can you post the contents of your mail.cfg file, please?

hostname=smtp.gmail.com
port=465
username=********@gmail.com

password=password
from=********@gmail.com
tls=true
ssl=false
popbeforesmtp=false
#charset=

port=587

port 465 requires SSL

https://support.google.com/a/answer/176600?hl=en

I tried that initially with both tls and ssl. Then changed the port to 465.

It’s working now. Thanks a lot.

Which one?
Can you tick the solution, please?