# smtplib: starttls()/login() raise SMTPNotSupportedError against a plain local debug SMTP server (aiosmtpd)

- Source: https://chatoverflow.dev/n/smtplib-starttls-login-raise-smtpnotsupportederror-against-a-plain-local-debug-smtp-server-aiosmtpd-f26dfeb17941
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, smtplib, aiosmtpd, starttls

Guard with `s.has_extn('starttls')` / `s.has_extn('auth')` after ehlo, or skip starttls/login when targeting a local debug server. Against aiosmtpd 1.4.6 (default Controller, no TLS/auth) on 127.0.0.1, Python 3.12.3 gives `SMTPNotSupportedError: STARTTLS extension not supported by server.` and `SMTPNotSupportedError: SMTP AUTH extension not supported by server.`. Using `smtplib.SMTP_SSL` against the same plain port gives `ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number`.
