Skip to content
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: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 1e23ad0 commit c364b6b3616d3f0840d6e7bd86787d53ac04c6c8 @gdub gdub committed
Showing with 4 additions and 1 deletion.
  1. +4 −1 django/core/
5 django/core/
@@ -119,7 +119,10 @@ def open(self):
# Nothing to do if the connection is already open.
return False
- self.connection = smtplib.SMTP(, 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.port,
+ local_hostname=DNS_NAME.get_fqdn())
if self.use_tls:

0 comments on commit c364b6b

Please sign in to comment.
Something went wrong with that request. Please try again.