I'm trying to send an attachment with this Python code to send emails via Outlook.
The code at the moment looks like this and it works to send text msg, but my Eexcel file is not attaching.
import win32com.client
olMailItem = 0x0
obj = win32com.client.Dispatch("Outlook.Application")
newMail = obj.CreateItem(olMailItem)
newMail.Subject = "test"
newMail.Body = "123"
newMail.To = "[email protected]"
attachment1 = "C:/Users/myuser/Desktop/aaa.xls"
newMail.Send()