2

I have a matplotlib plot, which I want to send over in an email. I have been able to send it as an email attachment using MIMEImage and smtp, but I want that image embedded within my mail, rather then sent as an attachment.

Any way to do this ?

This is sort of what I am doing as of now :

  fp = open('temp.png', 'rb')
  msgImage = MIMEImage(fp.read())
  fp.close()
  msgImage.add_header('Content-ID', '<image1>')
  msg.attach(msgImage)

And then sending the msg.as_string() using sendmail.

Vishal
  • 989
  • 2
  • 11
  • 19

0 Answers0