[GH-ISSUE #846] SMTP Not working for me in v2.9.2 #592

Closed
opened 2026-02-25 23:42:57 +03:00 by kerem · 15 comments
Owner

Originally created by @samcro1967 on GitHub (Jun 18, 2023).
Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/846

I do not seem to be able to get SMTP to work in v2.9.2. The same settings work with other applications. There are no error messages in the container logs. I also tried with a local SMTP relay server I have setup and it is not working either. Not sure where to look or what else to try with no error message. Everything in local_settings.py looks as it should. I have also checked the SPAM folder.

Anyone have any ideas?

docker compose

  healthchecks:
    hostname: healthchecks
    image: lscr.io/linuxserver/healthchecks:latest
    container_name: healthchecks
    restart: always
    environment:
      - TZ=${TZ}
      - PUID=${PUID}
      - PGID=${PGID}
      # https://healthchecks.io/docs/self_hosted_configuration/
      - SUPERUSER_EMAIL=${EMAIL}
      - SUPERUSER_PASSWORD=${PASSWORD}
      - DEBUG=True
      - SITE_ROOT=http://192.168.1.104:8114
      # CONFIG E-MAIL
      - DEFAULT_FROM_EMAIL=${EMAIL}
      - EMAIL_HOST=${SMTP}
      - EMAIL_HOST_PASSWORD=${GMAIL_PASSWORD}
      - EMAIL_HOST_USER=${EMAIL}
      - EMAIL_PORT=587
      - EMAIL_USE_TLS=True
    ports:
      - 8114:8000
    volumes:
      - ${docker}/healthchecks:/config
Originally created by @samcro1967 on GitHub (Jun 18, 2023). Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/846 I do not seem to be able to get SMTP to work in v2.9.2. The same settings work with other applications. There are no error messages in the container logs. I also tried with a local SMTP relay server I have setup and it is not working either. Not sure where to look or what else to try with no error message. Everything in `local_settings.py` looks as it should. I have also checked the SPAM folder. Anyone have any ideas? docker compose ``` healthchecks: hostname: healthchecks image: lscr.io/linuxserver/healthchecks:latest container_name: healthchecks restart: always environment: - TZ=${TZ} - PUID=${PUID} - PGID=${PGID} # https://healthchecks.io/docs/self_hosted_configuration/ - SUPERUSER_EMAIL=${EMAIL} - SUPERUSER_PASSWORD=${PASSWORD} - DEBUG=True - SITE_ROOT=http://192.168.1.104:8114 # CONFIG E-MAIL - DEFAULT_FROM_EMAIL=${EMAIL} - EMAIL_HOST=${SMTP} - EMAIL_HOST_PASSWORD=${GMAIL_PASSWORD} - EMAIL_HOST_USER=${EMAIL} - EMAIL_PORT=587 - EMAIL_USE_TLS=True ports: - 8114:8000 volumes: - ${docker}/healthchecks:/config ```
kerem closed this issue 2026-02-25 23:42:57 +03:00
Author
Owner

@cuu508 commented on GitHub (Jun 19, 2023):

I tested the following:

docker run --rm -it \
  --name=ls-healthchecks \
  -e DB_NAME=/tmp/hc.sqlite \
  -e DEFAULT_FROM_EMAIL=FIXME-USERNAME@gmail.com \
  -e EMAIL_HOST=smtp.gmail.com \
  -e EMAIL_PORT=587 \
  -e EMAIL_HOST_USER=FIXME-USERNAME@gmail.com \
  -e EMAIL_HOST_PASSWORD=FIXME-VALID-PASSWORD \
  -e EMAIL_USE_TLS=True \
  -p 8000:8000 \
  lscr.io/linuxserver/healthchecks:latest

I used the signup form and email arrived.

I then tested the same, but with a deliberately incorrect password. After sending email, I saw an error message in container logs:

[pid: 177|app: 0|req: 3/3] 172.17.0.1 () {48 vars in 849 bytes} [Mon Jun 19 13:55:42 2023] POST /accounts/signup/ => generated 54 bytes in 390 msecs (HTTP/1.1 200) 8 headers in 331 bytes (1 switches on core 0)
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "/app/healthchecks/hc/lib/emails.py", line 25, in run
    self.message.send()
  File "/lsiopy/lib/python3.11/site-packages/django/core/mail/message.py", line 298, in send
    return self.get_connection(fail_silently).send_messages([self])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lsiopy/lib/python3.11/site-packages/django/core/mail/backends/smtp.py", line 127, in send_messages
    new_conn_created = self.open()
                       ^^^^^^^^^^^
  File "/lsiopy/lib/python3.11/site-packages/django/core/mail/backends/smtp.py", line 94, in open
    self.connection.login(self.username, self.password)
  File "/usr/lib/python3.11/smtplib.py", line 750, in login
    raise last_exception
  File "/usr/lib/python3.11/smtplib.py", line 739, in login
    (code, resp) = self.auth(
                   ^^^^^^^^^^
  File "/usr/lib/python3.11/smtplib.py", line 662, in auth
    raise SMTPAuthenticationError(code, resp)
smtplib.SMTPAuthenticationError: (535, b'5.7.8 Username and Password not accepted. Learn more at\n5.7.8  https://support.google.com/mail/?p=BadCredentials g24-20020a2e9cd8000000b002ad988efd73sm2510020ljj.14 - gsmtp')

<!-- gh-comment-id:1597249278 --> @cuu508 commented on GitHub (Jun 19, 2023): I tested the following: ``` docker run --rm -it \ --name=ls-healthchecks \ -e DB_NAME=/tmp/hc.sqlite \ -e DEFAULT_FROM_EMAIL=FIXME-USERNAME@gmail.com \ -e EMAIL_HOST=smtp.gmail.com \ -e EMAIL_PORT=587 \ -e EMAIL_HOST_USER=FIXME-USERNAME@gmail.com \ -e EMAIL_HOST_PASSWORD=FIXME-VALID-PASSWORD \ -e EMAIL_USE_TLS=True \ -p 8000:8000 \ lscr.io/linuxserver/healthchecks:latest ``` I used the signup form and email arrived. I then tested the same, but with a deliberately incorrect password. After sending email, I saw an error message in container logs: ``` [pid: 177|app: 0|req: 3/3] 172.17.0.1 () {48 vars in 849 bytes} [Mon Jun 19 13:55:42 2023] POST /accounts/signup/ => generated 54 bytes in 390 msecs (HTTP/1.1 200) 8 headers in 331 bytes (1 switches on core 0) Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python3.11/threading.py", line 1038, in _bootstrap_inner self.run() File "/app/healthchecks/hc/lib/emails.py", line 25, in run self.message.send() File "/lsiopy/lib/python3.11/site-packages/django/core/mail/message.py", line 298, in send return self.get_connection(fail_silently).send_messages([self]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/lsiopy/lib/python3.11/site-packages/django/core/mail/backends/smtp.py", line 127, in send_messages new_conn_created = self.open() ^^^^^^^^^^^ File "/lsiopy/lib/python3.11/site-packages/django/core/mail/backends/smtp.py", line 94, in open self.connection.login(self.username, self.password) File "/usr/lib/python3.11/smtplib.py", line 750, in login raise last_exception File "/usr/lib/python3.11/smtplib.py", line 739, in login (code, resp) = self.auth( ^^^^^^^^^^ File "/usr/lib/python3.11/smtplib.py", line 662, in auth raise SMTPAuthenticationError(code, resp) smtplib.SMTPAuthenticationError: (535, b'5.7.8 Username and Password not accepted. Learn more at\n5.7.8 https://support.google.com/mail/?p=BadCredentials g24-20020a2e9cd8000000b002ad988efd73sm2510020ljj.14 - gsmtp') ```
Author
Owner

@samcro1967 commented on GitHub (Jun 19, 2023):

I am not getting an error message so I don't think it is a bad password issue. I created a new Gmail app password and it never shows up in the Gmail dashboard that the password was used when I try to signup a new user. I can take that same password and set it up in another app. It works and the password then shows as used. Seem like the email never leaves the app and reaches Gmail even though there are no error messages.

<!-- gh-comment-id:1597286272 --> @samcro1967 commented on GitHub (Jun 19, 2023): I am not getting an error message so I don't think it is a bad password issue. I created a new Gmail app password and it never shows up in the Gmail dashboard that the password was used when I try to signup a new user. I can take that same password and set it up in another app. It works and the password then shows as used. Seem like the email never leaves the app and reaches Gmail even though there are no error messages.
Author
Owner

@rangitoto72 commented on GitHub (Jun 19, 2023):

I too have the same issue.
Fresh docker install this evening using lscr.io/linuxserver/healthchecks:latest
I created a new Username / Password in ny mail server, i can send emails too and from this account using another application i have by updating to the new credentials.

However when using the credentials with this docker image:

Nothing comes to my inbox.

File "/lsiopy/lib/python3.11/site-packages/django/core/mail/message.py", line 298, in send
return self.get_connection(fail_silently).send_messages([self])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/lsiopy/lib/python3.11/site-packages/django/core/mail/backends/smtp.py", line 127, in send_messages
new_conn_created = self.open()
^^^^^^^^^^^
File "/lsiopy/lib/python3.11/site-packages/django/core/mail/backends/smtp.py", line 94, in open
self.connection.login(self.username, self.password)
File "/usr/lib/python3.11/smtplib.py", line 750, in login
raise last_exception
File "/usr/lib/python3.11/smtplib.py", line 739, in login
(code, resp) = self.auth(
^^^^^^^^^^
File "/usr/lib/python3.11/smtplib.py", line 662, in auth

<!-- gh-comment-id:1597546543 --> @rangitoto72 commented on GitHub (Jun 19, 2023): I too have the same issue. Fresh docker install this evening using lscr.io/linuxserver/healthchecks:latest I created a new Username / Password in ny mail server, i can send emails too and from this account using another application i have by updating to the new credentials. However when using the credentials with this docker image: Nothing comes to my inbox. File "/lsiopy/lib/python3.11/site-packages/django/core/mail/message.py", line 298, in send return self.get_connection(fail_silently).send_messages([self]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/lsiopy/lib/python3.11/site-packages/django/core/mail/backends/smtp.py", line 127, in send_messages new_conn_created = self.open() ^^^^^^^^^^^ File "/lsiopy/lib/python3.11/site-packages/django/core/mail/backends/smtp.py", line 94, in open self.connection.login(self.username, self.password) File "/usr/lib/python3.11/smtplib.py", line 750, in login raise last_exception File "/usr/lib/python3.11/smtplib.py", line 739, in login (code, resp) = self.auth( ^^^^^^^^^^ File "/usr/lib/python3.11/smtplib.py", line 662, in auth
Author
Owner

@cuu508 commented on GitHub (Jun 19, 2023):

@samcro1967, @rangitoto72 can you try the command that I used, swap in your username and password, leave everything else as-is?

docker run --rm -it \
  --name=ls-healthchecks \
  -e DB_NAME=/tmp/hc.sqlite \
  -e DEFAULT_FROM_EMAIL=FIXME-USERNAME@gmail.com \
  -e EMAIL_HOST=smtp.gmail.com \
  -e EMAIL_PORT=587 \
  -e EMAIL_HOST_USER=FIXME-USERNAME@gmail.com \
  -e EMAIL_HOST_PASSWORD=FIXME-VALID-PASSWORD \
  -e EMAIL_USE_TLS=True \
  -p 8000:8000 \
  lscr.io/linuxserver/healthchecks:latest
<!-- gh-comment-id:1597549180 --> @cuu508 commented on GitHub (Jun 19, 2023): @samcro1967, @rangitoto72 can you try the command that I used, swap in your username and password, leave everything else as-is? ``` docker run --rm -it \ --name=ls-healthchecks \ -e DB_NAME=/tmp/hc.sqlite \ -e DEFAULT_FROM_EMAIL=FIXME-USERNAME@gmail.com \ -e EMAIL_HOST=smtp.gmail.com \ -e EMAIL_PORT=587 \ -e EMAIL_HOST_USER=FIXME-USERNAME@gmail.com \ -e EMAIL_HOST_PASSWORD=FIXME-VALID-PASSWORD \ -e EMAIL_USE_TLS=True \ -p 8000:8000 \ lscr.io/linuxserver/healthchecks:latest ```
Author
Owner

@samcro1967 commented on GitHub (Jun 19, 2023):

That worked. The only difference is the DB_NAME. Maybe my DB is corrupt somehow?

<!-- gh-comment-id:1597553654 --> @samcro1967 commented on GitHub (Jun 19, 2023): That worked. The only difference is the DB_NAME. Maybe my DB is corrupt somehow?
Author
Owner

@cuu508 commented on GitHub (Jun 20, 2023):

@samcro1967 the other difference is using plain docker vs docker-compose. Perhaps variable substitution in your docker-compose.yml is not working properly?

<!-- gh-comment-id:1598828913 --> @cuu508 commented on GitHub (Jun 20, 2023): @samcro1967 the other difference is using plain docker vs docker-compose. Perhaps variable substitution in `your docker-compose.yml` is not working properly?
Author
Owner

@cuu508 commented on GitHub (Jun 20, 2023):

Ah, also, the Linuxserver image has this REGENERATE_SETTINGS thing – perhaps the container is using old values?

<!-- gh-comment-id:1598831985 --> @cuu508 commented on GitHub (Jun 20, 2023): Ah, also, the Linuxserver image has this `REGENERATE_SETTINGS` thing – perhaps the container is using old values?
Author
Owner

@cuu508 commented on GitHub (Jun 22, 2023):

@samcro1967, @rangitoto72 did you figure out what the issue was?

<!-- gh-comment-id:1602701855 --> @cuu508 commented on GitHub (Jun 22, 2023): @samcro1967, @rangitoto72 did you figure out what the issue was?
Author
Owner

@samcro1967 commented on GitHub (Jun 22, 2023):

Getting the environment variables correct and then starting the container with no DB or local setting file solved it for me. Seems like trying to adjust the variables after the DB and setting files has been created did not work.

<!-- gh-comment-id:1602823124 --> @samcro1967 commented on GitHub (Jun 22, 2023): Getting the environment variables correct and then starting the container with no DB or local setting file solved it for me. Seems like trying to adjust the variables after the DB and setting files has been created did not work.
Author
Owner

@crhbetz commented on GitHub (Jul 25, 2023):

starting the container with no DB or local setting file

So the way to change email settings is wiping my complete installation ...?

<!-- gh-comment-id:1650192738 --> @crhbetz commented on GitHub (Jul 25, 2023): `starting the container with no DB or local setting file` So the way to change email settings is wiping my complete installation ...?
Author
Owner

@samcro1967 commented on GitHub (Jul 25, 2023):

I use docker compose and they are set as environment variables in my compose file. So when I removed the DB and local setting file, there were correctly recreated from the environment variables. When the variables were not correct or did not work, I updated them, removed the container, DB and setting files, and recreated the container. Tested and did again until it was working. Hope that helps.

<!-- gh-comment-id:1650230046 --> @samcro1967 commented on GitHub (Jul 25, 2023): I use docker compose and they are set as environment variables in my compose file. So when I removed the DB and local setting file, there were correctly recreated from the environment variables. When the variables were not correct or did not work, I updated them, removed the container, DB and setting files, and recreated the container. Tested and did again until it was working. Hope that helps.
Author
Owner

@crhbetz commented on GitHub (Jul 25, 2023):

Thanks for replying!

I think I had understood as much - so again, removed the container, DB and setting files, and recreated the container means deleting my whole setup, because my checks etc are stored in that DB that needs to be removed?

<!-- gh-comment-id:1650237708 --> @crhbetz commented on GitHub (Jul 25, 2023): Thanks for replying! I think I had understood as much - so again, `removed the container, DB and setting files, and recreated the container` means deleting my whole setup, because my checks etc are stored in that DB that needs to be removed?
Author
Owner

@samcro1967 commented on GitHub (Jul 25, 2023):

Ah gotcha ya. I did not start setting up things until I had tested to make sure everything was working. I only setup one check during my testing phase.

I just looked thru the DB with LSIO sqlitebrowser and did not see any obvious signs of the settings being stored there. Did you try to only remove the settings file?

Good luck.

<!-- gh-comment-id:1650275844 --> @samcro1967 commented on GitHub (Jul 25, 2023): Ah gotcha ya. I did not start setting up things until I had tested to make sure everything was working. I only setup one check during my testing phase. I just looked thru the DB with LSIO sqlitebrowser and did not see any obvious signs of the settings being stored there. Did you try to only remove the settings file? Good luck.
Author
Owner

@cuu508 commented on GitHub (Jul 28, 2023):

@crhbetz Healthchecks (the web application that lives in this repository) does not store its configuration in the database, it reads it from environment variables, and also from the local_settings.py file if it exists next to the settings.py file.

If you are using the 3rd-party linuxserver docker image, I cannot comment on how it handles settings, or what precautions you need to make when using it in order not to lose your data.

<!-- gh-comment-id:1655212104 --> @cuu508 commented on GitHub (Jul 28, 2023): @crhbetz Healthchecks (the web application that lives in this repository) does not store its configuration in the database, it reads it from environment variables, and also from the `local_settings.py` file if it exists next to the `settings.py` file. If you are using the 3rd-party linuxserver docker image, I cannot comment on how it handles settings, or what precautions you need to make when using it in order not to lose your data.
Author
Owner

@crhbetz commented on GitHub (Sep 21, 2023):

Thanks for getting back to this. Unfortunately I missed my notification until now ...

I'll refrain from using a ping because I can't provide any more relevant info.

I'm using the docker/docker-compose.yml from this repository with the line image: healthchecks/healthchecks:v2.10 _un_commented.

After commenting on this issue, I played around a little more because testing with the provided docker run command I had been able to send mails. Eventually, I got it to work, but I'm unable to name a specific thing that finally made it work. It's happily been sending mails ever since.

<!-- gh-comment-id:1729155056 --> @crhbetz commented on GitHub (Sep 21, 2023): Thanks for getting back to this. Unfortunately I missed my notification until now ... I'll refrain from using a ping because I can't provide any more relevant info. I'm using the `docker/docker-compose.yml` from this repository with the line `image: healthchecks/healthchecks:v2.10` _un_commented. After commenting on this issue, I played around a little more because testing with the provided [docker run command](https://github.com/healthchecks/healthchecks/issues/846#issuecomment-1597549180) I had been able to send mails. Eventually, I got it to work, but I'm unable to name a specific thing that finally made it work. It's happily been sending mails ever since.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/healthchecks#592
No description provided.