SMTP backend should try harder to figure out the local host name
|Reported by:||Jacob||Owned by:||sernin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||yes||Patch needs improvement:||yes|
Django's SMTP backend sets the
local_hostname argument to
smtplib.SMTP by calling
django.core.mail.utils.DNS_NAME, which caches that result).
smtplib itself uses a slightly more robust method (see
smtplib around line 245) if
local_hostname isn't given.
In certain circumstances this can mean that sending mail through
smtplib directly works, but sending it via
We could solve this by just passing
local_hostname=None, but that'd result in a DNS lookup every time we send email, which is silly (and which is why we're caching it in the first place).
DNS_NAME should use similar logic to
smtplib to try harder to get the DNS hostname.
Change History (11)
comment:6 Changed 6 years ago by
|Patch needs improvement:||set|
|Triage Stage:||Ready for checkin → Accepted|