发布时间:2019-08-27 08:16:40编辑:auto阅读(3325)
本地安装了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中的 // 与 / 的区别
51753
51439
41846
38619
33112
30105
28774
23771
23685
22053
90°
2283°
2978°
2484°
2422°
3035°
2433°
3239°
5342°
5159°