mirror of https://github.com/django/django.git
Fixed #6835 -- Use cached FQDN when creating `smtplib.SMTP()` connection to avoid a lengthy
`socket.getfqdn()` call, thanks George Murdocca and PhiR. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7348 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
1e23ad0b65
commit
c364b6b361
|
@ -119,7 +119,10 @@ class SMTPConnection(object):
|
|||
# Nothing to do if the connection is already open.
|
||||
return False
|
||||
try:
|
||||
self.connection = smtplib.SMTP(self.host, self.port)
|
||||
# If local_hostname is not specified, socket.getfqdn() gets used.
|
||||
# For performance, we use the cached FQDN for local_hostname.
|
||||
self.connection = smtplib.SMTP(self.host, self.port,
|
||||
local_hostname=DNS_NAME.get_fqdn())
|
||||
if self.use_tls:
|
||||
self.connection.ehlo()
|
||||
self.connection.starttls()
|
||||
|
|
Loading…
Reference in New Issue