Receive email notifications

Which port does it use?
I’m really lost, I still get this error even when I change the SMTP Server Security Protocol.

here is a rule which should trigger the sending of the email, I don’t know if it is well written

rule “insectarium split eteint”
when
Item premier_interrupteur changed from ON to OFF
then
val mailActions = getActions(“mail”,“mail:smtp:6f4cf15a”)
mailActions.sendMail(“example@gmail.com”, “Etat du split de l_insectarium”, “Le split de l_insectarium est eteint.”)Receive email notifications
end

No idea. That is question about the gmail service that you have chosen to use, and the port that they have selected for users like you to use.

https://www.google.co.uk/search?q=gmail+smtp+port+number&oq=gmail+smtp+port+number

Yes, that wouldn’t fix a wrong port.

Always the same error, I created a mail.cfg file in the services folder

hostname=smtp.gmail.com
port=587
username=myemail@gmail.com
password=mypassword
from=myemail@gmail.com
tls=true

but same thing

Why?
That is the way to configure mail binding version 1

mail binding version 2 is configured in a completely different way.

Use the documentation that goes with the binding version that you have installed.
Don’t use old tutorials you found on the web.

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 https://www.openhab.org/addons/bindings/mail/
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
https://www.google.com/search?q=gmail+smtp+security+settings

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

OR

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: https://support.google.com/mail/answer/7126229 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
thanks

ok,thanks

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: smtp.gmail.com”.