本文整理汇总了Python中gmail.Gmail._remove_bcc_from_header方法的典型用法代码示例。如果您正苦于以下问题:Python Gmail._remove_bcc_from_header方法的具体用法?Python Gmail._remove_bcc_from_header怎么用?Python Gmail._remove_bcc_from_header使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gmail.Gmail
的用法示例。
在下文中一共展示了Gmail._remove_bcc_from_header方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_remove_bcc_from_header
# 需要导入模块: from gmail import Gmail [as 别名]
# 或者: from gmail.Gmail import _remove_bcc_from_header [as 别名]
def test_remove_bcc_from_header(self):
"""
Test if Bcc is removed from message header before send it
"""
my_sender = 'Me <[email protected]>'
to = 'Leo Iannacone <[email protected]>'
Cc = 'Leo2 Iannacone <[email protected]>, Leo3 Iannacone <[email protected]>'
Bcc = ['Leo{0} Nnc <leo{0}@tests.com>'.format(i) for i in range(4, 30)]
Bcc = ', '.join(Bcc)
payload = 'This is the payload of test_remove_bcc_from_header'
m = MIMEText(payload)
m['To'] = to
m['Cc'] = Cc
m['Bcc'] = Bcc
m['From'] = my_sender
new_message = Gmail._remove_bcc_from_header(m)
# message must be a correct email (parsable)
new_message = email.message_from_string(new_message)
self.assertIsInstance(new_message, Message)
# must not have 'Bcc'
self.assertFalse('Bcc' in new_message)
# and must have the same payload
self.assertEqual(payload, new_message.get_payload())