Mail Action using wrong port

I configured the mail action like this:

# The SMTP server hostname, e.g. ""

# the SMTP port to use (optional, defaults to 25 (resp. 587 for TLS/SSL))

# the username and password if the SMTP server requires authentication

# The email address to use for sending mails

# set to "true", if STARTTLS is enabled (not required) for the connection
# (optional, defaults to false)

# set to "true", if SSL negotiation should occur on connection
# do not use both tls=true and ssl=true
# (optional, defaults to false)

# 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)

# Character set used to encode message body
# (optional, if not provided platform default is used)

But it doesn’t work and what I see in the log output is the following:

10:11:24.950 [ERROR] [org.openhab.action.mail.internal.Mail] - Could not send e-mail to ''.
org.apache.commons.mail.EmailException: Sending the email to the following server failed :

What I am confused about is that the port is 465 and I configured 587. The mail.cfg definitely has the port 587 configured. I already restarted the whole server to be sure that the config was reloaded but it is still the same.
Somebody has an idea what the issue is?

Check the content of userdata/config/org/openhab/*.config if the changes you made to the *.cfg have made it into it.
If not delete the *.config and restart openHAB.

Also see:

This is also valid for any other cfg file.

Hm, I don’t really understand what to do. I have no path userdata/config/org/openhab/ on my server.

Check the docs for file locations:

so it is at the path /var/lib/openhab2/config/org/openhab/mail.config
I removed it and restarted the server.
Now it connects to the correct port.
Thanks for you help!

1 Like