Skip to content

Commit 34707f2

Browse files
committed
fix: EHLO 재전송을 통해 STARTTLS 이후 503 오류를 방지하도록 수정
1 parent 95a4f4f commit 34707f2

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

app/core/email_backends.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ def _authenticate_xoauth2(self) -> None:
7979
if not self.username:
8080
raise SMTPAuthenticationError(530, b"EMAIL_HOST_USER must be set to the Gmail address.")
8181

82+
# STARTTLS 이후 smtplib가 ehlo_resp를 비워두기 때문에, docmd("AUTH") 전에 EHLO를 재전송해야 503을 피할 수 있다.
83+
self.connection.ehlo_or_helo_if_needed()
8284
auth_payload = f"user={self.username}\x01auth=Bearer {self._access_token}\x01\x01"
8385
auth_payload = f"XOAUTH2 {b64encode(auth_payload.encode()).decode()}"
8486
code, response = self.connection.docmd("AUTH", auth_payload)

0 commit comments

Comments
 (0)