[SOLVED] One again a topic: sendmail

I try to send email via sendMail using @gmail.com and/or @web.de; it does not work.
what do I have to pay attention to the configuration

(tls / ssl …)
i mean there is a logic inside the action software because the port is not taken from the mail.cfg file

depending on the mail.cfg i get
2019-06-18 23:00:01.811 [ERROR] [rg.openhab.action.mail.internal.Mail] - Could not send e-mail to ‘xxx@web.de’.
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) ~[?:?]


2019-06-18 22:59:01.113 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Nachricht’: An error occurred during the script execution: Could not invoke method: org.eclipse.smarthome.model.script.actions.LogAction.logInfo(java.lang.String,java.lang.String,java.lang.Object[]) on instance: null

This is my working config for gmail:

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

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

Hello. I detected later that the mail server blocked my login with the message. “unknown device” .
I had to confirm that "yes I was with the login" and after this everything is running well with this setting.


The initial problem probably is caused because you did not allow “Third Party Apps” in your Gmail account settings.

1 Like

It’s also worth noting for future readers of this thread, that if you have two-factor authentication turned on for your Gmail (you really really should) that you will need to create an app password. Go to your Google account page, Security, and App Password. Generate a new password. Don’t lose that password. It is impossible to get it back after you close that screen and you will have to generate a new one.

Use that random string as your password and you can get the safety of using two-factor authentication and still have the ability to send email from openHAB or other services on your machines.