summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJannis Leidel <jannis@leidel.info>2010-12-21 15:28:11 +0000
committerJannis Leidel <jannis@leidel.info>2010-12-21 15:28:11 +0000
commit2565b8070640e23b1e3dc302923d75aff35bbdcb (patch)
tree88cb250b0ba329bca637327a5cccf91b21edf160 /tests
parent0e651d3fd464dbc2e8c22c62dc9a62c2057efa6e (diff)
[1.2.X] Fixed #14301 -- Further refine changes made in r14217 to support non-ASCII characters in email addresses. Thanks, Claude Peroz and Andi Albrecht.
Backport from trunk (r15006). git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@15007 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/mail/tests.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/regressiontests/mail/tests.py b/tests/regressiontests/mail/tests.py
index 47b62eabcc..877df1c4f5 100644
--- a/tests/regressiontests/mail/tests.py
+++ b/tests/regressiontests/mail/tests.py
@@ -351,3 +351,25 @@ class MailTests(TestCase):
self.assertEqual(message.from_email, from_email)
self.assertEqual(message.to, [to_email])
self.assertTrue(message.message().as_string().startswith('Content-Type: text/plain; charset="utf-8"\nMIME-Version: 1.0\nContent-Transfer-Encoding: quoted-printable\nSubject: Subject\nFrom: =?utf-8?b?ZnLDtm1Aw7bDpMO8LmNvbQ==?=\nTo: =?utf-8?b?dMO2QMO2w6TDvC5jb20=?='))
+
+ def test_idn_smtp_send(self):
+ import smtplib
+ smtplib.SMTP = MockSMTP
+ from_email = u'fröm@öäü.com'
+ to_email = u'tö@öäü.com'
+ connection = mail.get_connection('django.core.mail.backends.smtp.EmailBackend')
+ self.assertTrue(send_mail('Subject', 'Content', from_email, [to_email], connection=connection))
+
+class MockSMTP(object):
+ def __init__(self, host='', port=0, local_hostname=None,
+ timeout=1):
+ pass
+
+ def sendmail(self, from_addr, to_addrs, msg, mail_options=[],
+ rcpt_options=[]):
+ for addr in to_addrs:
+ str(addr.split('@', 1)[-1])
+ return {}
+
+ def quit(self):
+ return 0