示例#1
0
 def test_sanitize_address_portuguese(self):
     email = sanitize_address((u'Acentuação', '*****@*****.**'))
     if PY3:
         self.assertEqual(
             email,
             u'=?utf-8?b?QWNlbnR1YcOnw6Nv?= <*****@*****.**>')
     else:
         self.assertEqual(email, u'Acentuação <*****@*****.**>')
示例#2
0
 def test_sanitize_address_russian(self):
     email = sanitize_address((u'говорить', '*****@*****.**'))
     if PY3:
         self.assertEqual(
             email,
             u'=?utf-8?b?0LPQvtCy0L7RgNC40YLRjA==?= <*****@*****.**>'
         )
     else:
         self.assertEqual(email, u'говорить <*****@*****.**>')
示例#3
0
    def _build_data(self, message):
        email_data = {
            'to': sanitize_address_list(message.to),
            'cc': sanitize_address_list(message.cc),
            'bcc': sanitize_address_list(message.bcc),
            'from': sanitize_address(message.from_address),
            'subject': message.subject,
        }

        email_data['text'] = message.body
        email_data['html'] = message.html

        return email_data
示例#4
0
    def send_multiple(self, messages):
        if not messages:
            return

        new_connection = self.open()

        for message in messages:
            from_address = sanitize_address(message.from_address)
            recipients = join_address_list(message.recipients())
            self.connection.sendmail(from_address, recipients, message.raw())

        if new_connection:
            self.close()
示例#5
0
 def test_sanitize_address_tuple(self):
     email = sanitize_address(('FluentMail', '*****@*****.**'))
     self.assertEqual(email, 'FluentMail <*****@*****.**>')
示例#6
0
 def test_sanitize_address_alias(self):
     email = sanitize_address('FluentMail <*****@*****.**>')
     self.assertEqual(email, 'FluentMail <*****@*****.**>')
示例#7
0
 def test_sanitize_address(self):
     email = sanitize_address('*****@*****.**')
     self.assertEqual(email, '*****@*****.**')