Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending an Outlook 2010 email from Python

I am trying to send an email through Outlook 2010 with Python. The email sends properly but I get the following error. What could be causing it:

Error:

newMail.send()
TypeError: 'bool' object is not callable

My code:

import win32com.client
olMailItem = 0x0
obj = win32com.client.Dispatch("Outlook.Application")
newMail = obj.CreateItem(olMailItem)
newMail.Subject = "My Subject"
newMail.Body = "My Body"
newMail.To  = "[email protected]"
newMail.send()
like image 862
user2242044 Avatar asked Dec 31 '25 14:12

user2242044


1 Answers

You have a typo in your call, try this:

newMail.Send()
like image 90
vikramls Avatar answered Jan 03 '26 04:01

vikramls



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!