mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Fixed #11144 -- When a to/from/cc header contains unicode, make sure the email addresses are parsed correctly (especially with regards to commas). Thanks to rmt for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11719 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
		| @@ -7,7 +7,7 @@ from email.MIMEText import MIMEText | ||||
| from email.MIMEMultipart import MIMEMultipart | ||||
| from email.MIMEBase import MIMEBase | ||||
| from email.Header import Header | ||||
| from email.Utils import formatdate, parseaddr, formataddr | ||||
| from email.Utils import formatdate, getaddresses, formataddr | ||||
|  | ||||
| from django.conf import settings | ||||
| from django.core.mail.utils import DNS_NAME | ||||
| @@ -64,8 +64,7 @@ def forbid_multi_line_headers(name, val): | ||||
|     except UnicodeEncodeError: | ||||
|         if name.lower() in ('to', 'from', 'cc'): | ||||
|             result = [] | ||||
|             for item in val.split(', '): | ||||
|                 nm, addr = parseaddr(item) | ||||
|             for nm, addr in getaddresses((val,)): | ||||
|                 nm = str(Header(nm, settings.DEFAULT_CHARSET)) | ||||
|                 result.append(formataddr((nm, str(addr)))) | ||||
|             val = ', '.join(result) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user