~ubuntu-branches/debian/sid/python-django/sid

« back to all changes in this revision

Viewing changes to django/core/mail/backends/smtp.py

  • Committer: Package Import Robot
  • Author(s): Luke Faraone
  • Date: 2014-04-21 16:47:14 UTC
  • mfrom: (1.3.14)
  • Revision ID: package-import@ubuntu.com-20140421164714-3mlvyr7y1ssdo9e6
Tags: 1.6.3-1
* New upstream security release.
  - Unexpected code execution using ``reverse()``
  - CVE-2014-0472
  - Caching of anonymous pages could reveal CSRF token
  - CVE-2014-0473
  - MySQL typecasting could result in unexpected matches
  - CVE-2014-0474
* Drop patches 07_translation_encoding_fix and ticket21869.diff; merged
  upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
from django.core.mail.backends.base import BaseEmailBackend
8
8
from django.core.mail.utils import DNS_NAME
9
9
from django.core.mail.message import sanitize_address
10
 
from django.utils.encoding import force_bytes
11
10
 
12
11
 
13
12
class EmailBackend(BaseEmailBackend):
107
106
        recipients = [sanitize_address(addr, email_message.encoding)
108
107
                      for addr in email_message.recipients()]
109
108
        message = email_message.message()
110
 
        charset = message.get_charset().get_output_charset() if message.get_charset() else 'utf-8'
111
109
        try:
112
 
            self.connection.sendmail(from_email, recipients,
113
 
                    force_bytes(message.as_string(), charset))
114
 
        except:
 
110
            self.connection.sendmail(from_email, recipients, message.as_bytes())
 
111
        except smtplib.SMTPException:
115
112
            if not self.fail_silently:
116
113
                raise
117
114
            return False