[GH-ISSUE #546] SMTP AUTH extension not supported by server #396

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

Originally created by @kaysond on GitHub (Jul 24, 2021).
Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/546

I have a local smtp server running that doesn't require authentication, so I've set my env vars as follows:

      - DEFAULT_FROM_EMAIL=healthchecks@mail.domain.lan
      - EMAIL_HOST=10.7.1.2
      - EMAIL_PORT=25
      - EMAIL_USE_TLS=False
      - EMAIL_USE_SSL=False

Note that I've left off the username/password env vars. However, when I try to send an email, it fails with the error message below. Interestingly, Django is trying to execute self.connection.login(self.username, self.password) even though I didn't specify the user/pass env vars. I couldn't find anywhere else where those vars were specified, so according to the django docs, it shouldn't be trying to executing that at all...

Any ideas?

Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
    self.run()
  File "/app/healthchecks/./hc/lib/emails.py", line 28, in run
    msg.send()
  File "/usr/lib/python3.9/site-packages/django/core/mail/message.py", line 284, in send
    return self.get_connection(fail_silently).send_messages([self])
  File "/usr/lib/python3.9/site-packages/django/core/mail/backends/smtp.py", line 102, in send_messages
    new_conn_created = self.open()
  File "/usr/lib/python3.9/site-packages/django/core/mail/backends/smtp.py", line 69, in open
    self.connection.login(self.username, self.password)
  File "/usr/lib/python3.9/smtplib.py", line 711, in login
    raise SMTPNotSupportedError(
smtplib.SMTPNotSupportedError: SMTP AUTH extension not supported by server.
Originally created by @kaysond on GitHub (Jul 24, 2021). Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/546 I have a local smtp server running that doesn't require authentication, so I've set my env vars as follows: ``` - DEFAULT_FROM_EMAIL=healthchecks@mail.domain.lan - EMAIL_HOST=10.7.1.2 - EMAIL_PORT=25 - EMAIL_USE_TLS=False - EMAIL_USE_SSL=False ``` Note that I've left off the username/password env vars. However, when I try to send an email, it fails with the error message below. Interestingly, Django is trying to execute `self.connection.login(self.username, self.password)` even though I didn't specify the user/pass env vars. I couldn't find anywhere else where those vars were specified, so according to the django docs, it shouldn't be trying to executing that at all... Any ideas? ``` Exception in thread Thread-2: Traceback (most recent call last): File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner self.run() File "/app/healthchecks/./hc/lib/emails.py", line 28, in run msg.send() File "/usr/lib/python3.9/site-packages/django/core/mail/message.py", line 284, in send return self.get_connection(fail_silently).send_messages([self]) File "/usr/lib/python3.9/site-packages/django/core/mail/backends/smtp.py", line 102, in send_messages new_conn_created = self.open() File "/usr/lib/python3.9/site-packages/django/core/mail/backends/smtp.py", line 69, in open self.connection.login(self.username, self.password) File "/usr/lib/python3.9/smtplib.py", line 711, in login raise SMTPNotSupportedError( smtplib.SMTPNotSupportedError: SMTP AUTH extension not supported by server. ```
kerem closed this issue 2026-02-25 23:42:18 +03:00
Author
Owner

@cuu508 commented on GitHub (Jul 26, 2021):

Django docs say:

EMAIL_HOST_USER
Default: '' (Empty string)
Username to use for the SMTP server defined in EMAIL_HOST. If empty, Django won’t attempt authentication.

Healthchecks reads EMAIL_HOST_USER and EMAIL_HOST_PASSWORD from env vars, and uses empty strings as default values. So just having them absent should result in no authentication.

I just ran an experiment with a local debug SMTP server:

python -m smtpd -n -c DebuggingServer localhost:1025

And ran the development server like so:

EMAIL_HOST=localhost EMAIL_PORT=1025 EMAIL_USE_TLS=False ./manage.py runserver

It worked for me (TM), there was no exception when sending email, and the debug server printed the message.

If you are running Healthchecks with Docker, you could check if there are any setup scripts setting unexpected default values for EMAIL_HOST_USER and EMAIL_HOST_PASSWORD.

<!-- gh-comment-id:886705130 --> @cuu508 commented on GitHub (Jul 26, 2021): Django docs say: > EMAIL_HOST_USER > Default: '' (Empty string) > Username to use for the SMTP server defined in EMAIL_HOST. If empty, Django won’t attempt authentication. Healthchecks reads EMAIL_HOST_USER and EMAIL_HOST_PASSWORD from env vars, and uses empty strings as default values. So just having them absent _should_ result in no authentication. I just ran an experiment with a local debug SMTP server: ``` python -m smtpd -n -c DebuggingServer localhost:1025 ``` And ran the development server like so: ``` EMAIL_HOST=localhost EMAIL_PORT=1025 EMAIL_USE_TLS=False ./manage.py runserver ``` It worked for me (TM), there was no exception when sending email, and the debug server printed the message. If you are running Healthchecks with Docker, you could check if there are any setup scripts setting unexpected default values for EMAIL_HOST_USER and EMAIL_HOST_PASSWORD.
Author
Owner

@kaysond commented on GitHub (Jul 26, 2021):

Aha! It's a downstream problem.
I checked the container environment, and I'm using the right env vars, but the container manually writes to local_settings.py and uses a default username and password

> docker exec healthchecks sh -c 'env | grep EMAIL_'
EMAIL_HOST=10.7.1.2
EMAIL_PORT=25
EMAIL_USE_SSL=False
EMAIL_USE_TLS=False
<!-- gh-comment-id:886912851 --> @kaysond commented on GitHub (Jul 26, 2021): Aha! It's a downstream problem. I checked the container environment, and I'm using the right env vars, but the container manually writes to local_settings.py and uses a default `username` and `password` ``` > docker exec healthchecks sh -c 'env | grep EMAIL_' EMAIL_HOST=10.7.1.2 EMAIL_PORT=25 EMAIL_USE_SSL=False EMAIL_USE_TLS=False ```
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#396
No description provided.