Mail Action using wrong port

Tags: #<Tag:0x00007f2fadcaea70>

Hi,
I configured the mail action like this:

# The SMTP server hostname, e.g. "smtp.gmail.com"
hostname=mailserver.eu

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

# the username and password if the SMTP server requires authentication
username=myopenhab
password=mypassword

# The email address to use for sending mails
from=openhab@mailserver.eu

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

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 'user@domain.eu'.
org.apache.commons.mail.EmailException: Sending the email to the following server failed : mailserver.eu:465

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:

OK,
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