I've created several DataFrames and would like to add them to the body of the email I am sending. Do I need to convert each DataFrame to html and then the html to a table? It's the last step that I am having an issue with. My code is below and at the moment it sends the html format of the dataframe (not a nice table).
import win32com.client as win32
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = 'my email address'
mail.Subject = 'My subject'
html1 = mydataframe.to_html()
mail.Body = hmtl1
mail.Send()
Change
mail.Body = hmtl1
to
mail.HTMLBody = hmtl1
(credit to a colleague)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With