美丽心灵公益论坛

查看: 1624|回复: 0

Python用Outlook发送邮件

[复制链接]
累计签到:57 天
连续签到:1 天

981

主题

461

回帖

8037

积分

版主

Rank: 7Rank: 7Rank: 7

积分
8037
发表于 2022-4-13 10:57:11| 字数 534 来自手机 | 显示全部楼层 |阅读模式

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

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

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()
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|免责及版权声明|关于|美丽心灵公益论坛

GMT+8, 2025-12-18 11:55 , Processed in 0.368751 second(s), 26 queries .

Powered by Discuz! X3.4

!copyright!

快速回复 返回顶部 返回列表