这是我在互联网上找到并根据需要修改的代码:
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = 'W57007'
mail.Subject = 'Message subject'
mail.Body = 'Message body'
mail.HTMLBody = '<h2>HTML Message body</h2>' #this field is optional
# To attach a file to the email (optional):
# attachment = "Path to the attachment"
# mail.Attachments.Add(attachment)
mail.Send()
运行此命令时,出现以下错误:
mail.Send()
pywintypes.com_error: (-2147467260, 'Operation aborted', None, None)
请帮助我缓解此错误。需要任何其他详细信息,请让我知道!