I am sending emails in Python with CID inline images. The inline images work fine: they show up embedded in the email and the email itself does not appear to have attachments.
However, in the Gmail inbox view, it shows the inline image as an attachment:
Here is a simplified version of my email sending code:
message = MIMEMultipart()
message['Subject'] = emailSubject
message['From'] = fromAddress
message['To'] = toAddress
# the html contains <img src="cid:INLINE_IMAGE"/>
part = MIMEText(emailHtml, 'html')
message.attach(part)
fp = open(imagePath, 'rb')
image = MIMEImage(fp.read())
fp.close()
image.add_header('Content-ID', "INLINE_IMAGE")
image.add_header('Content-Disposition', 'inline', filename="inline-image.png")
message.attach(image)
If I take out the Content-Disposition
header, the attachment is labeled noname
in the Gmail inbox.
Is there a way to make this image not show up as an attachment in the inbox?
email
documentation. – Hydrolyze