|
Send email with Outlook and Python |
|
|
|
A simple example to send emails via Outlook and Python win32com.
import win32com.client
s = win32com.client.Dispatch("Mapi.Session")
o = win32com.client.Dispatch("Outlook.Application")
s.Logon("Outlook2003")
Msg = o.CreateItem(0)
Msg.To = "recipient@domain.com"
Msg.CC = "more email addresses here"
Msg.BCC = "more email addresses here"
Msg.Subject = "The subject of you mail"
Msg.Body = "The main body text of you mail"
attachment1 = "Path to attachment no. 1"
attachment2 = "Path to attachment no. 2"
Msg.Attachments.Add(attachment1)
Msg.Attachments.Add(attachment2)
Msg.Send() |
|
Last Updated ( Thursday, 18 August 2011 )
|