hello!
i installed mail action and checked the configuration serveral times, but I still get “535 Authentication credentials invalid” as error. it doesn’t matter if i use tls or ssl, the error remains the same. gmx only offers the following help: https://hilfe.gmx.net/pop-imap/imap/imap-serverdaten.html
mail config:
# The SMTP server hostname, e.g. "smtp.gmail.com"
hostname=mail.gmx.net
# the SMTP port to use (optional, defaults to 25 (resp. 587 for TLS/SSL))
#port=465
# the username and password if the SMTP server requires authentication
username=NAME
password=PASS
# The email address to use for sending mails
from=NAME
# set to "true", if STARTTLS is enabled (not required) for the connection
# (optional, defaults to false)
#tls=true
# set to "true", if SSL negotiation should occur on connection
# do not use both tls=true and ssl=true
# (optional, defaults to false)
ssl=true
# set to "true", if POP before SMTP (another authentication mechanism)
# should be enabled. Username and Password are taken from the above
# configuration (optional, default to false)
popbeforesmtp=false
# Character set used to encode message body
# (optional, if not provided platform default is used)
#charset=
2019-05-13 09:27:25.062 [ERROR] [rg.openhab.action.mail.internal.Mail] - Could not send e-mail to 'MAILTOME@gmx.de'.
org.apache.commons.mail.EmailException: Sending the email to the following server failed : mail.gmx.net: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:1086) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeOperation(XbaseInterpreter.java:1061) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._invokeFeature(XbaseInterpreter.java:1047) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeFeature(XbaseInterpreter.java:992) ~[?:?]
at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:151) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:902) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:865) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:224) ~[?:?]
at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:447) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:228) ~[?:?]
at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluate(XbaseInterpreter.java:190) ~[?:?]
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:341) ~[?:?]
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: 535 Authentication credentials invalid
at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:809) ~[27:javax.mail:1.4.4]
at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:752) ~[27:javax.mail:1.4.4]
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:669) ~[27:javax.mail:1.4.4]
at javax.mail.Service.connect(Service.java:317) ~[27:javax.mail:1.4.4]
at javax.mail.Service.connect(Service.java:176) ~[27:javax.mail:1.4.4]
at javax.mail.Service.connect(Service.java:125) ~[27:javax.mail:1.4.4]
at javax.mail.Transport.send0(Transport.java:194) ~[27:javax.mail:1.4.4]
at javax.mail.Transport.send(Transport.java:124) ~[27:javax.mail:1.4.4]
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1411) ~[?:?]
... 32 more
That link says you should use port 587 and tls, not ssl, or use port 465 and ssl.
In any case I would remove the comment # before the port and set it explicitly.
It’s bit hard to tell from the stack trace, but it could be that your mail provider doesn’t support TLS 1.0.
From what I can tell, the underlying libs used by the mail action are an older version that uses TLS 1.0. At least that was my experience recently when the mail action broke for no apparent reason after working for years. A little research with my mail service provider exposed that they had just disabled TLS 1.0.
My solution was to switch to the new mail binding, which works fine (although it does require some minor editing of the rules). If you decide to try the new binding, there are some 3rd party libs that need to be dropped into addons.
In console, verify everything is installed and active.
openhab> list -s | grep mail
282 │ Active │ 80 │ 2.5.0.201905040410 │ org.openhab.binding.mail
285 │ Active │ 80 │ 1.6.2 │ com.sun.mail.javax.mail
286 │ Active │ 80 │ 1.5.0 │ org.apache.commons.email
In Paper UI, create an SMTP thing and enter all the info needed by your mail service provider.
Modify rule to invoke sendMail like this.
val mailActions = getActions("mail","mail:smtp:mymailserviceprovider")
mailActions.sendMail("me@me.com", "This is the subject line", "This is the mail content.")
2019-05-13 20:53:08.662 [ERROR] [st.core.internal.thing.ThingResource] - Exception during HTTP PUT request for update config at 'things/mail:smtp:e447b91c/config'
java.lang.IllegalStateException: Thing with UID mail:smtp:e447b91c has no handler attached.
at
org.eclipse.smarthome.core.thing.internal.ThingRegistryImpl.updateConfiguration(ThingRegistryImpl.java:93)
~[?:?]
at
org.eclipse.smarthome.io.rest.core.internal.thing.ThingResource.updateConfiguration(ThingResource.java:438)
[404:org.eclipse.smarthome.io.rest.core:0.10.0.oh240]
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.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
[456:org.glassfish.jersey.core.jersey-server:2.22.2]
at
org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)
[456:org.glassfish.jersey.core.jersey-server:2.22.2]
at
org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)
[456:org.glassfish.jersey.core.jersey-server:2.22.2]
at
org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160)
[456:org.glassfish.jersey.core.jersey-server:2.22.2]
at
org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)
[456:org.glassfish.jersey.core.jersey-server:2.22.2]
at
org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
[456:org.glassfish.jersey.core.jersey-server:2.22.2]
at
org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)
[456:org.glassfish.jersey.core.jersey-server:2.22.2]
at
org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
[456:org.glassfish.jersey.core.jersey-server:2.22.2]
at
org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326)
[456:org.glassfish.jersey.core.jersey-server:2.22.2]
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
[455:org.glassfish.jersey.core.jersey-common:2.22.2]
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
[455:org.glassfish.jersey.core.jersey-common:2.22.2]
at
org.glassfish.jersey.internal.Errors.process(Errors.java:315)
[455:org.glassfish.jersey.core.jersey-common:2.22.2]
at
org.glassfish.jersey.internal.Errors.process(Errors.java:297)
[455:org.glassfish.jersey.core.jersey-common:2.22.2]
at
org.glassfish.jersey.internal.Errors.process(Errors.java:267)
[455:org.glassfish.jersey.core.jersey-common:2.22.2]
at
org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
[455:org.glassfish.jersey.core.jersey-common:2.22.2]
at
org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
[456:org.glassfish.jersey.core.jersey-server:2.22.2]
at
org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
[456:org.glassfish.jersey.core.jersey-server:2.22.2]
at
org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)
[453:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
at
org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
[453:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
at
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
[453:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
at
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
[453:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
at
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
[453:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
at
com.eclipsesource.jaxrs.publisher.internal.ServletContainerBridge.service(ServletContainerBridge.java:76)
[304:com.eclipsesource.jaxrs.publisher:5.3.1.201602281253]
at
org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865)
[369:org.eclipse.jetty.servlet:9.4.11.v20180605]
at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:535)
[369:org.eclipse.jetty.servlet:9.4.11.v20180605]
at
org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71)
[470:org.ops4j.pax.web.pax-web-jetty:7.2.3]
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
[368:org.eclipse.jetty.server:9.4.11.v20180605]
at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
[366:org.eclipse.jetty.security:9.4.11.v20180605]
at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
[368:org.eclipse.jetty.server:9.4.11.v20180605]
at
org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
[368:org.eclipse.jetty.server:9.4.11.v20180605]
at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
[368:org.eclipse.jetty.server:9.4.11.v20180605]
at
org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
[368:org.eclipse.jetty.server:9.4.11.v20180605]
at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1317)
[368:org.eclipse.jetty.server:9.4.11.v20180605]
at
org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:293)
[470:org.ops4j.pax.web.pax-web-jetty:7.2.3]
at
org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
[368:org.eclipse.jetty.server:9.4.11.v20180605]
at
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
[369:org.eclipse.jetty.servlet:9.4.11.v20180605]
at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
[368:org.eclipse.jetty.server:9.4.11.v20180605]
at
org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
[368:org.eclipse.jetty.server:9.4.11.v20180605]
at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1219)
[368:org.eclipse.jetty.server:9.4.11.v20180605]
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
[368:org.eclipse.jetty.server:9.4.11.v20180605]
at
org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80)
[470:org.ops4j.pax.web.pax-web-jetty:7.2.3]
at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
[368:org.eclipse.jetty.server:9.4.11.v20180605]
at org.eclipse.jetty.server.Server.handle(Server.java:531)
[368:org.eclipse.jetty.server:9.4.11.v20180605]
at
org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:352)
[368:org.eclipse.jetty.server:9.4.11.v20180605]
at
org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
[368:org.eclipse.jetty.server:9.4.11.v20180605]
at
org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:281)
[359:org.eclipse.jetty.io:9.4.11.v20180605]
at
org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
[359:org.eclipse.jetty.io:9.4.11.v20180605]
at
org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:291)
[359:org.eclipse.jetty.io:9.4.11.v20180605]
at
org.eclipse.jetty.io.ssl.SslConnection$3.succeeded(SslConnection.java:151)
[359:org.eclipse.jetty.io:9.4.11.v20180605]
at
org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
[359:org.eclipse.jetty.io:9.4.11.v20180605]
at
org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
[359:org.eclipse.jetty.io:9.4.11.v20180605]
at
org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
[371:org.eclipse.jetty.util:9.4.11.v20180605]
at
org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
[371:org.eclipse.jetty.util:9.4.11.v20180605]
at
org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
[371:org.eclipse.jetty.util:9.4.11.v20180605]
at
org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
[371:org.eclipse.jetty.util:9.4.11.v20180605]
at
org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
[371:org.eclipse.jetty.util:9.4.11.v20180605]
at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:762)
[371:org.eclipse.jetty.util:9.4.11.v20180605]
at
org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:680)
[371:org.eclipse.jetty.util:9.4.11.v20180605]
at java.lang.Thread.run(Thread.java:748) [?:?]
I’m not sure what to suggest. I assume you tried a restart?
I have it running on an early 2.5 snapshot (build 1502, before all the reintegration work) as well as a very recent 2.5 snapshot. Maybe there’s a compatibility issue with 2.4.
i just found out that there should also be a mail binding in the docs… mail binding mail action
i have only set up mail.cfg so far. do i also have to create a new thing to send mails?