0

Can I insert an image in the msg area, can do as an attachment or as an html code. I have tried as html code but it just outputs the html code as a string.

import pandas as pd
import smtplib

SenderAddress='<xxxx@gmail.com>'

e = pd.read_excel("C:-=-.Email.xls")
emails = e['Emails'].values
server = smtplib.SMTP("smtp.gmail.com:587")
server.starttls()
server.login('xxx@gmail.com', 'xxxxx')

msg = 'image here'

subject = "Test"
body = "Subject: {}\n\n{}".format(subject,msg.as_string())
for email in emails:
  server.sendmail(SenderAddress, email, body)
server.quit()
noob13
  • 3
  • 3

0 Answers0