Python用Outlook发送邮件

电脑技术 电脑技术 1215 人阅读 | 0 人回复 | 2022-04-13

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

x
s = win32com.client.Dispatch("Mapi.Session")
o = win32com.client.Dispatch("Outlook.Application")
s.Logon("Outlook2003")
   
Msg = o.CreateItem(0)
Msg.To = "recipient@domain.com"
   
Msg.CC = "more email addresses here"
Msg.BCC = "more email addresses here"
   
Msg.Subject = "The subject of you mail"
Msg.Body = "The main body text of you mail"
   
attachment1 = "Path to attachment no. 1"
attachment2 = "Path to attachment no. 2"
Msg.Attachments.Add(attachment1)
Msg.Attachments.Add(attachment2)

Msg.Send()
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则