#30608: Email messages crash on non-unicode hostnames.
--------------------------------+------------------------------------
Reporter: Chason Chaffin | Owner: nobody
Type: Bug | Status: new
Component: Core (Mail) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------
Changes (by felixxm):
* version: 2.2 => master
* stage: Unreviewed => Accepted
Comment:
Thanks for the report. Simple encoding should fix this issue, e.g.
{{{
diff --git a/django/core/mail/utils.py b/django/core/mail/utils.py
index d18dfe4667..68f9e464d6 100644
--- a/django/core/mail/utils.py
+++ b/django/core/mail/utils.py
@@ -14,6 +14,10 @@ class CachedDnsName:
def get_fqdn(self):
if not hasattr(self, '_fqdn'):
self._fqdn = socket.getfqdn()
+ try:
+ self._fqdn.encode('ascii')
+ except UnicodeEncodeError:
+ self._fqdn = self._fqdn.encode('idna').decode('ascii')
return self._fqdn
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30608#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.a7b1322659c34cc662fd74752636d020%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.