Cannot send mails via gmail server anymore (OH 2.x)


I have a rule that sends mails using OH 2.x using mail actions. This is done via smtp and google mail and used to work fine in the past.

Recently, this has stopped working. Mails are not sent anymore and everytime a mail shall be sent the following entry appears in the log:

2021-07-12 23:26:37.178 [WARN ] [ab.binding.mail.internal.SMTPHandler] - Sending the email to the following server failed :

2021-07-12 23:26:37.180 [WARN ] [ab.binding.mail.internal.SMTPHandler] - javax.mail.AuthenticationFailedException: 535-5.7.8 Username and Password not accepted. Learn more at

535 5.7.8

(The “learn more” link does not help here).

I wonder what has changed and what can I do about it. I also don’t think that I am the only one using gmail with Mail Actions so this problem has probably also appeared for other users?

Thanks a lot,

One additional comment: The “access for less secure apps” in Gmail is already active. This does not help.

G**gle requires you to use app passwords/tokens to relay mail. Not an OH issue. Search over at gmail.

This happened to me in OH3 and might be the same for you.

Did you try to set a new application password ? Could be that google does not accept it to be a valid one. The other problem could be outdated encryption methods but then I would expect to see an other error message. Sending mails via OH via gmail still works although I must say that my test was done with OH3.

I tried setting an application password via google but it does not help. OpenHAB keeps showing the same error message as above.

Does OpenHAB read the new mail.cfg file as configuration at all? I also tried restarting OpenHAB but also no effect.

Depends what you are using. There’s a Mail Action v1 and Mail binding v1 that read file mail.cfg. There’s a Mail binding v2, with Things. channels, and included Actions, that does not use mail.cfg

1 Like

I’m using the Mail action. The mail.cfg is used, but I cannot tell when the configuration is reread. However, as restarting OpenHAB does not help, it must be a different root cause…