Add gmail relay handling for emails

This change adds ehlo and starttls when the server hostname is smtp-relay.gmail.com and authentication is disabled.
Just sending the message and quitting isn't enough for gmail specifically.
This commit is contained in:
Alexandra Stone 2023-12-27 14:07:57 -07:00 committed by GitHub
parent aa029b005f
commit abfeafa026
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -221,6 +221,12 @@ class CoreSettings(BaseAuditModel):
)
server.send_message(msg)
server.quit()
if self.smtp_host == "smtp-relay.gmail.com" and not self.smtp_requires_auth:
# gmail smtp relay specific handling.
server.ehlo()
server.starttls()
server.send_message(msg)
server.quit()
else:
# smtp relay. no auth required
server.send_message(msg)