Skip to content

Commit 9bb3c1e

Browse files
committed
make smtp login fail immediately if error code = 535 and ext code == 5.7.8 (auth error)
1 parent 1cf3d78 commit 9bb3c1e

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

Lib/smtplib.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,8 @@ def login(self, user, password, *, initial_response_ok=True):
744744
if code in (235, 503):
745745
return (code, resp)
746746
except SMTPAuthenticationError as e:
747+
# get out immediately if bad password
748+
if e.smtp_code == 535 and e.smtp_error[:5] == b'5.7.8': raise e
747749
last_exception = e
748750

749751
# We could not login successfully. Return result of last attempt.

0 commit comments

Comments
 (0)