E-Mail Notification failed

yes but i’m using app-specific password

So I tried this configuration with 587, 465 and even regenerating the password, nothing works.
Fun fact: Google doesn’t even show the password as used

I am using GoDaddy mail, and it worked .

Try another domain , i also face same problem from gmail.

I already make it work with another domain, but that’s not the point of course. We are trying to make it work with Google

Hi @Denis , I started Docker via docker-compose -p openremote up -d

Grüße zurück :smiley:

Apologies, please see this thread:

Hi Rich
did another pull, but still no luck with Google

tried with this

      OR_EMAIL_HOST: gmail.smtp.com
      OR_EMAIL_USER: myemail@domain.com
      OR_EMAIL_PASSWORD: xxxxxxxxxxxx
      OR_EMAIL_PORT: ${OR_EMAIL_PORT:-587}
      OR_EMAIL_TLS: ${OR_EMAIL_TLS:-true}
      OR_EMAIL_X_HEADERS:
      OR_EMAIL_FROM: myemail@domain.com
#      OR_EMAIL_ADMIN: ${OR_EMAIL_ADMIN:-myemail@domain.com}

and this

      OR_EMAIL_HOST: gmail.smtp.com
      OR_EMAIL_USER: myemail@domain.com
      OR_EMAIL_PASSWORD: xxxxxxxxxxxx
      OR_EMAIL_PORT: ${OR_EMAIL_PORT:-587}
      OR_EMAIL_TLS: ${OR_EMAIL_TLS:-STARTTLS}
      OR_EMAIL_X_HEADERS:
      OR_EMAIL_FROM: myemail@domain.com
#      OR_EMAIL_ADMIN: ${OR_EMAIL_ADMIN:-myemail@domain.com}

The error is always the same
manager_1 | 2023-04-26 09:50:21.456 WARNING [Messaging-NotificationQu…e-26] manager.notification.NotificationService : Error processing from REALM_RULESET - NOTIFICATION_HANDLER_CONFIG_ERROR (Handler is not valid: email): Notification{name=‘null’, message=org.openremote.model.notification.EmailNotificationMessage@1d9e8e96, repeatFrequency=null, repeatInterval=‘null’, targets=[Target{type=CUSTOM, id=myemail@mydomain.com}]}

edit: app-specific password still shows as never used on Google side

You need to look at the startup section of the logs, when the EmailNotificationHandler is initialised it tries to connect to the SMTP server and there you should see more information about the failure.

Seems like he doesn’t like my credentials, but I tried with two different passwords
I’ll try to investigate more, I really don’t understand what’s wrong

manager_1     | 2023-04-26 10:36:42.026  SEVERE  [main                          ] er.notification.EmailNotificationHandler : Failed to connect to SMTP server so disabling email notifications
manager_1     | org.eclipse.angus.mail.util.MailConnectException: Couldn't connect to host, port: gmail.smtp.com, 587; timeout -1;
manager_1     |   nested exception is:
manager_1     |         java.net.UnknownHostException: gmail.smtp.com
manager_1     |         at org.eclipse.angus.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2258)
manager_1     |         at org.eclipse.angus.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:753)
manager_1     |         at jakarta.mail.Service.connect(Service.java:364)
manager_1     |         at jakarta.mail.Service.connect(Service.java:222)
manager_1     |         at jakarta.mail.Service.connect(Service.java:171)
manager_1     |         at org.openremote.manager.notification.EmailNotificationHandler.init(EmailNotificationHandler.java:106)
manager_1     |         at org.openremote.container.Container.start(Container.java:162)
manager_1     |         at org.openremote.container.Container.startBackground(Container.java:207)
manager_1     |         at org.openremote.manager.Main.main(Main.java:31)
manager_1     | Caused by: java.net.UnknownHostException: gmail.smtp.com
manager_1     |         at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:567)
manager_1     |         at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327)
manager_1     |         at java.base/java.net.Socket.connect(Socket.java:633)
manager_1     |         at java.base/java.net.Socket.connect(Socket.java:583)
manager_1     |         at org.eclipse.angus.mail.util.SocketFetcher.createSocket(SocketFetcher.java:361)
manager_1     |         at org.eclipse.angus.mail.util.SocketFetcher.getSocket(SocketFetcher.java:236)
manager_1     |         at org.eclipse.angus.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2208)
manager_1     |         ... 8 more
manager_1     | 2023-04-26 10:36:42.028  INFO    [main                          ] er.notification.EmailNotificationHandler : SMTP credentials are not valid so email notifications will not function

Looks like you’ve got your host the wrong way around should be smtp.gmail.com

1 Like

I can’t believe myself right now, gonna cry in a corner

Simple mistakes happen :grin:

Hopefully all working for you now

1 Like

Thanks Rich
I tried again (with correct smtp) with the following combinations (and even a new password)

with 587 and STARTTLS I get

	Notification failed '122090': Target{type=CUSTOM, id=my@email.com}, reason=Email send failed: 530 5.7.0 Must issue a STARTTLS command first. c16-20020a05600c0ad000b003f198dfbbfcsm12234427wmr.19 - gsmtp

with 587 and true I get

Notification failed '122098': Target{type=CUSTOM, id=my@email.com}, reason=Email send failed: 530 5.7.0 Must issue a STARTTLS command first. n16-20020a05600c181000b003f046ad52efsm21274706wmp.31 - gsmtp

With 465 and true

manager_1     | 2023-04-26 14:50:33.862  SEVERE  [main                          ] er.notification.EmailNotificationHandler : Failed to connect to SMTP server so disabling email notifications
manager_1     | jakarta.mail.MessagingException: Got bad greeting from SMTP host: smtp.gmail.com, port: 465, response: [EOF]
manager_1     |         at org.eclipse.angus.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2246)
manager_1     |         at org.eclipse.angus.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:753)
manager_1     |         at jakarta.mail.Service.connect(Service.java:364)
manager_1     |         at jakarta.mail.Service.connect(Service.java:222)
manager_1     |         at jakarta.mail.Service.connect(Service.java:171)
manager_1     |         at org.openremote.manager.notification.EmailNotificationHandler.init(EmailNotificationHandler.java:106)
manager_1     |         at org.openremote.container.Container.start(Container.java:162)
manager_1     |         at org.openremote.container.Container.startBackground(Container.java:207)
manager_1     |         at org.openremote.manager.Main.main(Main.java:31)
manager_1     | 2023-04-26 14:50:33.864  INFO    [main                          ] er.notification.EmailNotificationHandler : SMTP credentials are not valid so email notifications will not function

With 465 and SSL I get

manager_1     | 2023-04-26 14:54:03.824  SEVERE  [main                          ] er.notification.EmailNotificationHandler : Failed to connect to SMTP server so disabling email notifications
manager_1     | jakarta.mail.MessagingException: Got bad greeting from SMTP host: smtp.gmail.com, port: 465, response: [EOF]
manager_1     |         at org.eclipse.angus.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2246)
manager_1     |         at org.eclipse.angus.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:753)
manager_1     |         at jakarta.mail.Service.connect(Service.java:364)
manager_1     |         at jakarta.mail.Service.connect(Service.java:222)
manager_1     |         at jakarta.mail.Service.connect(Service.java:171)
manager_1     |         at org.openremote.manager.notification.EmailNotificationHandler.init(EmailNotificationHandler.java:106)
manager_1     |         at org.openremote.container.Container.start(Container.java:162)
manager_1     |         at org.openremote.container.Container.startBackground(Container.java:207)
manager_1     |         at org.openremote.manager.Main.main(Main.java:31)
manager_1     | 2023-04-26 14:54:03.825  INFO    [main                          ] er.notification.EmailNotificationHandler : SMTP credentials are not valid so email notifications will not function

Is this what you have tried? Note the need to use app specific passwords for authentication:

TLS/STARTTLS on port 587:

OR_EMAIL_HOST:smtp.gmail.com
OR_EMAIL_USER: email_address
OR_EMAIL_PASSWORD: app_specific_password

SSL on port 465:

OR_EMAIL_PROTOCOL: smtps
OR_EMAIL_PORT: 465
OR_EMAIL_TLS: false
OR_EMAIL_HOST:smtp.gmail.com
OR_EMAIL_USER: email_address
OR_EMAIL_PASSWORD: app_specific_password

yes STARTTLS doesn’t seem to work
tried second one (I didn’t have protocol:smtps) and I get

services.manager.environment.OR_EMAIL_TLS contains false, which is an invalid type, it should be a string, number, or a null

Tried commenting out TLS, same error as before

manager_1     | jakarta.mail.MessagingException: Got bad greeting from SMTP host: smtp.gmail.com, port: 465, response: [EOF]

Yes i’m using app-specific password

Hi,
i configured as per your suggestion but i am getting error

Notification failed ‘1119’: Target{type=CUSTOM, id=qwerty@gmail.com}, reason=Email send failed: Couldn’t connect to host, port: localhost, 25; timeout -1

my configuration

OR_EMAIL_PROTOCOL: smtps
OR_EMAIL_PORT: 465
OR_EMAIL_TLS: false
OR_EMAIL_HOST: smtp.gmail.com
OR_EMAIL_USER: apurba@lazot.com
OR_EMAIL_PASSWORD: xxxxxxxxxx
OR_EMAIL_X_HEADERS:
OR_EMAIL_FROM: apurba@lazot.com

kindly suggest if anything changes needed and i pulled latest manger also.

I guess the docker compose parser is getting stricter; just put quotes around the boolean value

Funny that true is considered a string and false is not lol

Now i get this

Notification failed '122165': Target{type=CUSTOM, id=my@email.com}, reason=Email send failed: Couldn't connect to host, port: localhost, 25; timeout -1```

Seems like he's trying to connect to itself on standard 25 port

Please provide the startup log section where EmailNotificationHandler is initialised and also the relevant section of your docker compose file (with sensitive data removed).

Hi Rich,
Got this below error in ui log

“Notification failed ‘1046’: Target{type=CUSTOM, id=koleyapurba007@gmail.com}, reason=Email send failed: Couldn’t connect to host, port: localhost, 25; timeout -1”

Pls check below log in starting

my yml file

environment:
OR_SETUP_TYPE:
OR_ADMIN_PASSWORD:
OR_SETUP_RUN_ON_RESTART:
OR_EMAIL_PROTOCOL: smtps
OR_EMAIL_PORT: 465
OR_EMAIL_TLS: false
OR_EMAIL_HOST: smtp.gmail.com
OR_EMAIL_USER: xxxx@lazot.com
OR_EMAIL_PASSWORD: xxxxxxxxx
OR_EMAIL_X_HEADERS:
OR_EMAIL_FROM: xxx@lazot.com
OR_HOSTNAME: ${OR_HOSTNAME:-localhost}
OR_ADDITIONAL_HOSTNAMES: ${OR_ADDITIONAL_HOSTNAMES:-}
OR_SSL_PORT: ${OR_SSL_PORT:–1}
OR_DEV_MODE: ${OR_DEV_MODE:-false}

Thanks