SMTP binding - gmail and oauth2

With the recent fix to the SMTP binding (Mail binding errors sending mail UnsupportedDataTypeException: text/plaijn; charset=UTF=8) I was excited to get my mail notifications working again.

However, it looks like gmail has stopped the use of ‘less secure apps’ and now requires OAuth2 so now I get the following error:
[WARN ] [ab.binding.mail.internal.SMTPHandler] - javax.mail.AuthenticationFailedException: 535-5.7.8 Username and Password not accepted.

Is there a simple way of implementing OAuth2 with the binding? My home dynamic IP is in a spamhaus block so I can’t send SMTP directly. How are you implementing mail notifications?


See How to configure the Mail Binding to use GMail for sending email from openHAB and pay attention to the creation of an App Password which will allow openHAB to log in with just a password even if you’ve got two-factor enabled on your account. I just verified this still works, for me at least.

1 Like

Thank you, that worked perfectly.