Esempio n. 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 <*****@*****.**>')
Esempio n. 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'говорить <*****@*****.**>')
Esempio n. 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
Esempio n. 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()
Esempio n. 5
0
 def test_sanitize_address_tuple(self):
     email = sanitize_address(('FluentMail', '*****@*****.**'))
     self.assertEqual(email, 'FluentMail <*****@*****.**>')
Esempio n. 6
0
 def test_sanitize_address_alias(self):
     email = sanitize_address('FluentMail <*****@*****.**>')
     self.assertEqual(email, 'FluentMail <*****@*****.**>')
Esempio n. 7
0
 def test_sanitize_address(self):
     email = sanitize_address('*****@*****.**')
     self.assertEqual(email, '*****@*****.**')