My objective is to use Python to send an e-mail to a Gmail user that has an inline image. It is not possible to host this image online and then link to it through a hr
hr
I think you need to add the following lines:
from email.mime.image import MIMEImage body = MIMEText('Test Image', _subtype='html') msg.attach(body) img = MIMEImage(image.read(), 'jpeg') img.add_header('Content-Id', '') msg.attach(img)
Test Image
testimage should be replaced with a unique identifier
testimage