linuxserver / docker-domoticz

GNU General Public License v3.0
43 stars 28 forks source link

Configure email notification with gmail #83

Closed ldes89150 closed 4 years ago

ldes89150 commented 4 years ago

While setting up email notification with gmail, I encounter the following error message.

The Active notification Subsystems: email (1/13) changed from 2/13 to 1/13 after I install the openssl.

apk add openssl

Environment

OS: Debian 10 CPU architecture: x86_64
How docker service was installed:

docker run   --name=domoticz   -e PUID=1000   -e PGID=1000     -p 8083:8080      -v /database/domoticz:/config   --device /dev/ttyACM0:/dev/ttyUSB0   --restart unless-stopped   linuxserver/domoticz

Command used to create docker container (run/create/compose/screenshot)

Docker logs

2020-07-02 20:03:11.084  Error: SMTP Mailer: Error sending Email to: <XXXXX@gmail.com> !
2020-07-02 20:03:11.084  Error: Failed to send Email notification!
2020-07-02 20:03:11.084  Notification sent (email) => Failed
2020-07-02 20:03:11.087  Active notification Subsystems: email (1/13)
tobbenb commented 4 years ago

Where do you set up Gmail notifications? I don't see anything about it in notification settings.

ldes89150 commented 4 years ago

@tobbenb

Sorry for causing the confusion. I set up the email settings with the Gmail SMTP server.

tobbenb commented 4 years ago

Is that a plugin?

ldes89150 commented 4 years ago

No, i didn't use any plugins

tobbenb commented 4 years ago

Can you please tell me how you set it up in details?

ldes89150 commented 4 years ago

sure! It is under Setup >> Settings >> Email

I use the following configurations. From: mygmail@gmail.com To: Server: smtp.google.com Port: 587 Username: mygmail@gmail.com Password: mygmailpassword

After sending a test mail, it shows "notification sent", but the mail isn't sent actually. Instead, I got the error message in the docker logs as described.

tobbenb commented 4 years ago

Don't know why I didn't see that....

Sending emails does work here not using a Gmail account. Tested with Gmail and got the same error. You probably need to set some security setting in gmails setting to allow "insecure" applications.

So there is nothing wrong with the container.

ldes89150 commented 4 years ago

@tobbenb The SMTP server you tested. Is it also using TLS? I suspect the problem comes from the TLS.

All my other applications (like grafana) can use Gmail's SMTP server without any issues, so I believe the problem comes from TLS.

Besides, I've installed Domoticz on Raspberry Pi before without docker, and it also works with Gmail.

tobbenb commented 4 years ago

I tested again with both SSL and TLS and both work. But you need to make an app password for domotics to use if you use two factor authentication. https://support.google.com/mail/answer/185833?hl=en

But looking again at your email setup, you haven't filled out the to address.