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