发布时间:2019-08-27 08:16:40编辑:auto阅读(3463)
本地安装了Python,导入了win32com、pythoncom等模块。
import win32com.client as win32
import warnings
import sys
import pythoncom
reload(sys)
sys.setdefaultencoding('utf8')
warnings.filterwarnings('ignore')
pythoncom.CoInitialize()
def sendmail():
sub = 'outlook python mail test'
body = 'my test\r\n my python mail'
outlook = win32.Dispatch('outlook.application')
receivers = ['xxx']
mail = outlook.CreateItem(0)
mail.To = receivers[0]
mail.Subject = sub.decode('utf-8')
mail.Body = body.decode('utf-8')
mail.Attachments.Add('C:\Users\xxx\Desktop\git_auto_pull_new.py')
mail.Send()
sendmail()系统弹窗提醒。

收到邮件

OutLook选项——信任中心——信任中心设置——编程访问——从不向我发出可疑活动警告

上一篇: python线程池(threadpool
下一篇: Python中的 // 与 / 的区别
52569
52491
42580
39488
33907
30875
29657
24557
24403
22777
60°
82°
159°
158°
188°
351°
345°
351°
417°
341°