I am relatively new to the coding world and trying to use the following python code to send automated email reports.. But i only get the dataframe in the automatic email and not the "Hi this is a test email" in the outlook email body.
Not really sure whats going wrong here.
import numpy as np
import pandas as pd
df = pd.DataFrame(np.random.randint(0,100,size=(10, 4)), columns=list('ABCD'))
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = 'user@email.com'
mail.Subject = 'Insert Subject here'
mailerr1=df.to_html()
attachment = 'shot.png'
mail.Attachments.Add(attachment)
mail.Body = "hi this is a test email"
mail.HTMLBody = mailerr1
mail.Send()
Would really appreciate it if someone could give me a heads up on whats happening here.. Thank you.