Monday, September 13, 2021

Creating a mail and send it using outlook in python

install pywin32

 

pip install pywin32

 

 

import win32com.client as client
outlook=client.Dispatch("Outlook.Application")
message=outlook.Createitem(0)
#namespace=outlook.GetNameSpace('MAPI')
#inbox=namespace.GetDefaultFolder(6)
message.To="allsourav@gmail.com;allsourav2@gmail.com"
message.CC="souravandamiya@gmail.com"
message.BCC="allsourav2@gmail.com"
message.Subject="Happy Birthday"
message.Body="Wish you a happy birthday ,learning outlook using python"
#message.Save()
message.Display()
#message.Send()


No comments:

Post a Comment