diff options
| author | Chason Chaffin <chason@gmail.com> | 2019-07-02 21:15:32 +0900 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-07-03 10:49:03 +0200 |
| commit | 55b68de643b5c2d5f0a8ea7587ab3b2966021ccc (patch) | |
| tree | 5dd25be844b8fbb312af34ece8bde95782399992 /django | |
| parent | f226bdbf4e06aa8ca787e34b0c626965ac526f28 (diff) | |
Fixed #30608 -- Fixed non-unicode EmailMessage crash when domain name for localhost is non-ASCII.
Assisted by felixxm.
Diffstat (limited to 'django')
| -rw-r--r-- | django/core/mail/utils.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/django/core/mail/utils.py b/django/core/mail/utils.py index d18dfe4667..1e48faa366 100644 --- a/django/core/mail/utils.py +++ b/django/core/mail/utils.py @@ -4,6 +4,8 @@ Email message and email sending related helper functions. import socket +from django.utils.encoding import punycode + # Cache the hostname, but do it lazily: socket.getfqdn() can take a couple of # seconds, which slows down the restart of the server. @@ -13,7 +15,7 @@ class CachedDnsName: def get_fqdn(self): if not hasattr(self, '_fqdn'): - self._fqdn = socket.getfqdn() + self._fqdn = punycode(socket.getfqdn()) return self._fqdn |
