bebleo / smtpdfix

A SMTP server for use as a pytest fixture that implements encryption and authentication.
MIT License
15 stars 5 forks source link

SMTP AUTH extension not supported by server. #48

Open jwodder opened 3 years ago

jwodder commented 3 years ago

On Python 3.9.2 on macOS 11.2.1, using pytest 6.2.2 and smtpdfix 0.2.9, the following test fails with smtplib.SMTPNotSupportedError: SMTP AUTH extension not supported by server.. Uncommenting the line that sets SMTPD_ENFORCE_AUTH does not make a difference. The test succeeds if the client.login() line is removed.

import smtplib

def test_smtpdfix(monkeypatch, smtpd):
    #monkeypatch.setenv("SMTPD_ENFORCE_AUTH", "True")
    client = smtplib.SMTP()
    client.connect(smtpd.hostname, smtpd.port)
    client.login("user", "password")
    client.quit()
jwodder commented 3 years ago

I've realized that AUTH on a non-SSL connection is disabled by default unless the SMTPD_AUTH_REQUIRE_TLS environment variable is set to False. This should be documented in the README.