2

Here is the code which I found in internet and modified according to my need:

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

When this is run, I get below error:

mail.Send()

pywintypes.com_error: (-2147467260, 'Operation aborted', None, None)

Please help me mitigate this error. Any further details needed, please let me know!

enter image description here

Koustav
  • 33
  • 6

1 Answers1

1

I had the same problem. The issue was that I had deleted a directory with the pst file inside

Ge Petavrakis
  • 27
  • 1
  • 4