summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Wilson Jr <gary.wilson@gmail.com>2008-03-21 21:08:39 +0000
committerGary Wilson Jr <gary.wilson@gmail.com>2008-03-21 21:08:39 +0000
commitc364b6b3616d3f0840d6e7bd86787d53ac04c6c8 (patch)
tree03d85e4fb201cb0abd449b893011925c2dbdd543
parent1e23ad0b655369161449120d78d01db402708ee4 (diff)
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
-rw-r--r--django/core/mail.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/django/core/mail.py b/django/core/mail.py
index bf6eca4f80..c9f6833a1c 100644
--- a/django/core/mail.py
+++ b/django/core/mail.py
@@ -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()