[英]Sending Email with Python Win32Com.Client Send Error
我有我的腳本通過 Python win32com.client 在 Outlook 上發送消息。 我可以創建電子郵件並格式化我的正文,但是當我嘗試執行newmail.Send()
我收到一個我無法弄清楚的錯誤。
以下是我的代碼以及錯誤:
obj = win32com.client.Dispatch("Outlook.Application")
newMail = obj.CreateItem(olMailItem)
newMail.Subject = "Subject"
newMail.Body = "Actualemail"
newMail.To = "test@test.com"
newMail.Send()
我收到以下錯誤:
Traceback (most recent call last):
File "<pyshell#105>", line 1, in <module>
newMail.Send()
File "<COMObject CreateItem>", line 2, in Send
pywintypes.com_error: (-2147467260, 'Operation aborted', None, None)
有沒有人處理過這個? 除了發送功能,其他一切都有效
我發現了這個問題。 出於某種原因,當我顯示電子郵件然后發送它時,它開始工作了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.