调用outlook发邮件

 

import win32com.client as win32
import pythoncom

pythoncom.CoInitialize()


def send_mail(**kwargs):
    outlook = win32.Dispatch(‘Outlook.Application‘)
    reciList = [‘1@1.com‘, ‘2@2.com‘]
    for i in range(len(reciList)):
        mail_item = outlook.CreateItem(0)  # 0: olMailItem
        mail_item.Recipients.Add(reciList[i])
        mail_item.Subject = ‘Mail Test‘
        mail_item.BodyFormat = 2  # 2: Html format
        mail_item.HTMLBody = ‘‘‘
            <H2>Hello, This is a test mail~~.</H2>
            Hello Guys. ‘‘‘

        # mail_item.Attachments.Add(‘d:\doc\IT Info.xlsx‘)
        mail_item.Send()


if __name__ == ‘__main__‘:
    send_mail()

  

调用outlook发邮件

上一篇:群体结构分析admixture


下一篇:性能测试自动化