Sending an email from outlook with an attachment

PHOTO EMBED

Thu Mar 11 2021 15:32:44 GMT+0000 (Coordinated Universal Time)

Saved by @stephenb30 #python

import win32com.client as win32

outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = 'email.here@email.com'
#mail.CC = "more email addresses here"
#mail.BCC = "more email addresses here"
mail.Subject = 'Write subject here'
mail.Body = 'Hi Receipient,\n\nPlease find the file attached.\n\nRegards,\nSender'
attachment  = FileLocation +'/filename.xlsx'.
mail.Attachments.Add(attachment)
mail.Send()
content_copyCOPY