I'm trying to send an email with an inline image using Python/Django.
Here is the code showing how I am doing it. It's still in development. So all it is meant to do for now is send a dummy email message with a picture of a bumble bee embedded in it.
Yet when I receive the email in my Gmail inbox, I see only the following text-based email. The various Mime parts of the email show up in the payload of the email as text. I clicked the forward button and cut-n-pasted the entire email below so you can see what I get.
Can someone suggest what I'm doing wrong here? And a possible solution?
From: myApplication <donotrespond@mywebsite.com>
Date: Tue, Feb 18, 2014 at 1:39 AM
Subject: Hello World
To: myemail@gmail.com
Content-Type: multipart/related;
boundary="===============5170682983005376168=="
MIME-Version: 1.0
--===============5170682983005376168==
Content-Type: text/html; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
<p>Hello <img src="cid:myimage" /></p>
--===============5170682983005376168==
Content-Type: image/jpeg
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Id: <myimage>
iVBORw0KGgoAAAANSUhEUgAABSsAAAV1CAYAAAD0tpuiAAAKQWlDQ1BJQ0MgUHJvZmlsZQAASA2d
lndUU9kWh8+9N73QEiIgJfQaegkg0jtIFQRRiUmAUAKGhCZ2RAVGFBEpVmRUwAFHhyJjRRQLg4Ji
1wnyEFDGwVFEReXdjGsJ7601896a/cdZ39nnt9fZZ+9917oAUPyCBMJ0WAGANKFYFO7rwVwSE8vE
<VERY LARGE PORTION SNIPPED>
BAgQIECAAIGaAsLKmnPVFQECBAgQIECAAAECBAgQIECAAIF0AsLKdCNTMAECBAgQIECAAAECBAgQ
IECAAIGaAsLKmnPVFQECBAgQIECAAAECBAgQIECAAIF0Av8HNFl0J1BnG68AAAAASUVORK5CYII=
--===============5170682983005376168==--