Skip to content

Commit 9700596

Browse files
committed
Added back a general setting (removed from the Django framework in 1.7) to avoid base64-encoding of UTF-8 email messages.
- Legacy-Id: 9012
1 parent 24abae6 commit 9700596

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

ietf/utils/mail.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from email.MIMEMessage import MIMEMessage
66
from email.MIMEMultipart import MIMEMultipart
77
from email import message_from_string
8+
from email import charset as Charset
9+
810
import smtplib
911
from django.conf import settings
1012
from django.contrib import messages
@@ -30,6 +32,10 @@
3032

3133
SMTP_ADDR = { 'ip4':settings.EMAIL_HOST, 'port':settings.EMAIL_PORT}
3234

35+
# Don't BASE64-encode UTF-8 messages so that we avoid unwanted attention from
36+
# some spam filters.
37+
Charset.add_charset('utf-8', Charset.SHORTEST, None, 'utf-8')
38+
3339
def empty_outbox():
3440
outbox[:] = []
3541

0 commit comments

Comments
 (0)