Permit SMTP to mail relay without authentication (#600)

This commit is contained in:
Deborah Pickett 2023-07-14 19:57:58 +00:00 committed by GitHub
parent 2d140f2e97
commit 824f5b289c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -218,6 +218,9 @@ with the password ``my:password``, it would be represented as::
smtp://someone%40example.com:my%3Apassword@smtp.example.com:25/
The username and password can be omitted, with a URL in the form
``smtp://host:port/``, if your mail server is a (properly firewalled!)
unauthenticated relay.
SendGrid
########

View file

@ -395,8 +395,10 @@ if SETUP.EMAIL_SERVER:
elif parsed.scheme == "smtp":
EMAIL_HOST = parsed.hostname
EMAIL_PORT = parsed.port
EMAIL_HOST_USER = urllib.parse.unquote(parsed.username)
EMAIL_HOST_PASSWORD = urllib.parse.unquote(parsed.password)
if parsed.username is not None:
EMAIL_HOST_USER = urllib.parse.unquote(parsed.username)
if parsed.password is not None:
EMAIL_HOST_PASSWORD = urllib.parse.unquote(parsed.password)
EMAIL_USE_TLS = as_bool(query.get("tls"))
EMAIL_USE_SSL = as_bool(query.get("ssl"))
else: