Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #6835 -- Use cached FQDN when creating `smtplib.SMTP()` connect…

…ion 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
  • Loading branch information...
commit c364b6b3616d3f0840d6e7bd86787d53ac04c6c8 1 parent 1e23ad0
Gary Wilson Jr. gdub authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 django/core/mail.py
5 django/core/mail.py
View
@@ -119,7 +119,10 @@ def open(self):
# 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()
Please sign in to comment.
Something went wrong with that request. Please try again.