Created
March 9, 2011 07:21
-
-
Save mdornseif/861822 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From f779766658a18af79555e73efb20d6bce1de83e0 Mon Sep 17 00:00:00 2001 | |
From: Maximillian Dornseif <[email protected]> | |
Date: Wed, 9 Mar 2011 08:18:48 +0100 | |
Subject: [PATCH] ndling ob Umlauts in Domains | |
--- | |
shop/tools.py | 13 +++++++++++++ | |
1 files changed, 13 insertions(+), 0 deletions(-) | |
diff --git a/shop/tools.py b/shop/tools.py | |
index 4e79ca1..a29720d 100644 | |
--- a/shop/tools.py | |
+++ b/shop/tools.py | |
@@ -135,6 +135,19 @@ def known_consignment(cart, form): | |
def send_mail(subject, message, recipient, sender=None, fail_silently=False, attachments=[], tag=None): | |
"""Send mail via Postmarkapp.com""" | |
+ # Umlaute in E-Mail Adressen sind ncht definiert und koennen dem Grunde nach ncht funktionieren. | |
+ # Das haelt natuerlich niemand davon ab, nicht doch zu versu hen, sie zu verwenden. | |
+ # Wir versuchen die betreffendne Namen nach IDNA zu codieren - vielleicht kommt die | |
+ # E-Mail dann an. Aus Bücher wird "xn--bcher-kva". | |
+ # Eigentlich muesstenw ir den ToASCII algorythmus verwenden, aber selbst das produziert | |
+ # ungueltige E-Mail Adressen. Siehe http://en.wikipedia.org/wiki/Internationalized_domain_name | |
+ # Wir Versuchen Doppel-Encoding zu vermeiden. Wenn 'xn--' im Namen vorkommt, dann ist er schon | |
+ # codiert. | |
+ # Problem ist hier noch, das wir nicht mit Empfaengern wie | |
+ # Dr. Trojan <ü[email protected]> | |
+ # umgehen koennen. | |
+ if not 'xn--' in recipient: | |
+ recipient = recipient.encide('idna') | |
mail = {'To': recipient, | |
'Subject': subject, | |
'TextBody': message, | |
-- | |
1.7.0.4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment