我想自动填写电子邮件并将其发送到联系人列表。
import subprocess
print("0")
def send_notification():
print("1")
outlook = subprocess.call(["/usr/bin/open","-W","-n","-a","/Applications/Microsoft Outlook.app"])
print("2")
mail = outlook.CreateItem(0)
print("3")
mail.To = 'somemail@gmail.com',
mail.Subject = 'Sent through Python'
mail.body = 'This email alert is auto generated. Please do not respond.'
mail.sent
print(send_notification())
输出: 0 1个 并且Outlook正在打开,但是 邮件= Outlook.CreateItem(0)不要反应。 程序继续工作,如果我手动停止它,则会得到以下按摩:
文件“ /anaconda3/lib/python3.7/subprocess.py”,行1559,在_try_wait中 (pid,sts)= os.waitpid(self.pid,wait_flags) 键盘中断 我使用Mac OS Mojave Outlook最后更新03.03.2019