Send Outlook Email Via Python? - Stack Overflow
stackoverflow.com › questions › 6332577Jun 13, 2011 · import win32com.client as win32outlook = win32.Dispatch('outlook.application')mail = outlook.CreateItem(0)mail.To = 'To address'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()