Receive email notifications

I deleted the mail.cfg file and here is the configuration of the smtp server

but always the same error

I followed the instructions of the documentation
and I admit that I don’t understand everything

That’s fine, but you have to find out.

I would think you’re going to need at least a username and password to go with that. Don’t show us those in a public forum!

I don’t think SSL is correct for that port

Gmail also has its own quirks beyond our control. See -

What is the username and password that I have to put?
Thank you very much for your patience

Oh come on … you can guess, surely :wink:
You are supplying openHAB with the details of a Gmail account for it to log in to, so that it can use your Gmail account to send emails.

Because you don’t want the whole world to use your Gmail account, it has a username and a password.
** Don’t show us that **
If you don’t know what they are, you will need to find out from Gmail.

So if you want openHAB to be able to use your Gmail account, it needs to know the username and password, and you would have to tell openHAB what those are by filling in some boxes on a form. We can guess what those boxes might be named.

I put my username and google password for the smtp username and password

But still nothing.

I really don’t know what to do so that the smtp host can send emails.

You didn’t say if you’ve done that enabling at Gmail.

You still have SSL/TLS set, I don’t know if that is correct for that port number.

I enabled it in Gmail but still not working
I must have missed something but I don’t know what

If you have two factor authentication enabled on your Google Account, you need to create an app password. This will be the password you need to use. If you do not have two factor authentication stop now and go turn it on. Your email is far too valuable of a target to have it only protected with a password.

Your user name is your Gmail account.

Leave the “Server Security Protocol” blank, as rossko57 has repeatedly told you to do.
Set the SMTP Server Security Protocol to STARTTLS.

And use port 587.

Gmail doesn’t use standard SMTP settings.

When it fails to connect using your current settings, you should see errors in openhab.log telling you why it failed to connect. For example, when I left the protocol blank it said in the logs that I needed to use STARTTLS. I think the status on the Thing also tells you why it failed to connect also. That will help you understand why it’s failing and what to do to make it work.

I turned on two-factor authentication and created an application password that I put in the stmp server password field when configuring the SMTP server, I left the “Server Security Protocol” blank but the plain value appears every time I come back to it, and I put the port number 587 but still that

I’ve written a full tutorial: How to configure the Mail Binding to use GMail for sending email from openHAB

See my edit above, you need to use STARTTLS

N.B. for gmail the two valid options are:

SMTP Server Security Protocol: STARTTLS
Server Port: 587


SMTP Server Security Protocol: SSL/TLS
Server Port: 465

I thought GMail shut down port 465 awhile back. Maybe I’m misremembering.

It’s still listed here: and the port is still open.

I did a quick check to make sure it is not actually SSL on port 465 and it did a TLS1.3 handshake.

I’ve not checked with a real email client so it could be that the port is open but it doesn’t let you authenticate if they have deprecated that port.

1 Like

I’ll check that


This may be a silly question but are you sure your openHAB host is connected to the internet?

I just looked back at your screenshot and noticed the “UnknownHostException:”.

Yes it is connected to the internet, I work in ssh and I configure by typing the ip address of my raspberrrypi in the navigation bar of my web browser to have access to Paper UI

It is possible to be able to connect to your raspberry pi over your local network but for it to still not be able to connect to the internet.
It could just be a confusing exception but if you are still having problems try connecting to your raspberry pi over ssh and use the “ping” command to check that it can even see the SMTP server:
ping -c4
If you have some kind of internet connectivity problem that would obviously explain why you cannot get the mail binding to work.

When I type via ssh: ping -c4, nothing happens, but when I type: ping, there are 100% lost packets.
You’re right, the raspberry is not connected to the internet

Hello everyone, I managed to send the notifications by email, thank you for your interventions which allowed me to get there.
Thank you