title: How to create an email with embedded images that is compatible with the most mail clients
body: <p>We have created a system that allows embedding an image in an outgoing email.</p>
  
  <p>Here is the original message our system creates. This example contains an image attachment and an embedded image.</p>
  
  <pre><code>Mime-Version: 1.0
  From: ...
  To: ...
  CC: 
  Subject: test
  x-sender: ...
  x-mailer: ...
  Content-Type: multipart/mixed; boundary="-------------...A128803765634794"
  
  ---------------...A128803765634794
  Content-Type: multipart/related; boundary="-------------...B128803765634796"
  
  ---------------...B128803765634796
  Content-Type: text/html; charset="UTF-8"
  
  &lt;p style="margin: 0; padding: 0"&gt;&lt;img src="cid:083.gif" alt="" /&gt;&lt;/p&gt;
  
  ---------------...B128803765634796
  Content-type: image/gif; name="083.gif"
  Content-ID: &lt;083.gif&gt;
  X-Attachment-Id: 083.gif
  Content-Disposition: Embedded; filename="083.gif"
  Content-transfer-encoding: base64
  
  ............................................................................
  ............................................................................
  ......................................................
  ---------------PineappleCodeB128803765634796--
  ---------------PineappleCodeA128803765634794
  Content-type: image/gif; name="waiting.gif"
  Content-Disposition: Attachment; filename="waiting.gif"
  Content-transfer-encoding: base64
  
  ............................................................................
  ............................................................................
  ......................................................
  ---------------PineappleCodeA128803765634794--
  </code></pre>
  
  <p>Is there another header I should add or rule I should follow?</p>
  
  <p><strong>I noticed one thing</strong>... I would guess that it is part my issue and part Gmails. but at any rate I would like to make it stop happening</p>
  
  <p>When the email is received into Gmail I get</p>
  
  <blockquote>
    <p>Images are not displayed.<br>
    Display images below - Always display images from ...</p>
  </blockquote>
  
  <p>The embedded image is then shown as an image attachment (just like my other image attachment)</p>
  
  <p>I click Display Images Below and my image is shown in the body of the email but not removed from the Attachments section.</p>
  
  <p>If I go back to my in box and back to the email it looks fine.</p>
  
  <p>I do not see why it does that. It it not a linked image (from external URL) and it does not happen when sending embedded images from Gmail to Gmail. That is what makes me think I might be doing somthing wrong and I am afraid that it may affect other recipients.</p>