【问题标题】:How do I send an email from python using outlook web access?如何使用 Outlook Web Access 从 python 发送电子邮件?
【发布时间】:2016-07-20 16:49:44
【问题描述】:

如果我的工作失败,我需要在 python 中发送电子邮件,但是由于公司政策,我只能使用 Outlook Web Access。如何从 python 连接到 Outlook Web Access 以发送电子邮件?

【问题讨论】:

标签: python email outlook outlook-web-app


【解决方案1】:

我不能对此表示赞赏,但我可以引导您找到可能的解决方案。

这是链接:http://win32com.goermezer.de/content/view/227/192/ 这是代码

import win32com.client

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()

这很酷,我必须使用它。 可以在这里找到相关的 SO 问题:Python - Send HTML-formatted email via Outlook 2007/2010 and win32com

【讨论】:

  • 我还应该提到我正在尝试从 mac/linux 发送电子邮件
  • 啊,我明白了。这是一个重要的警告。我会做一些挖掘工作。
  • 你还在挖吗?
  • 很遗憾,没有,我还没有,但我在一个工作场所,可以再次挖掘这个是合理的......
猜你喜欢
  • 2020-05-16
  • 2011-09-28
  • 2016-05-22
  • 1970-01-01
  • 2023-01-07
  • 1970-01-01
  • 2013-10-15
  • 2016-08-28
  • 1970-01-01
相关资源
最近更新 更多