title: Get Content-ID of attached image when composing a new email in iOS
body: <p>I'm using the <code>MFMailComposeViewController</code> in iOS to create a new dynamic email but have run into an issue when trying to use inline images.</p>
  
  <p><strong>I first tried adding the image as a base64 encoded string, i.e.</strong></p>
  
  <pre><code>&lt;img src="data:image/png;base64, blahblahblah" /&gt; 
  </code></pre>
  
  <p>But I can only view that on the iPad while Outlook/Entourage ignore it even though I can see it in the source!</p>
  
  <p>So now I'm trying to add the image as an attachment and link to it <strong>via it's content ID, i.e.</strong></p>
  
  <pre><code>&lt;img src="cid:BF6E8B41-4D74-419E-B55E-8F18A07381AE" id="BF6E8B41-4D74-419E-B55E-8F18A07381AE" width="509" height="220"&gt;
  </code></pre>
  
  <p><strong>But have no clue how to get the <code>cid</code> through code!</strong><br />
  <em>When I attach an image using <code>AddAttachmentData</code>, the image goes to the bottom and actually generates an <code>&lt;img /&gt;</code> tag with the cid!</em></p>
  
  <p>Additionally, this ID seems to change with every new email. The one above was my first try, then I sent another one and the Content-ID changed to </p>
  
  <pre><code>&lt;img src="cid:59EBFDED-2A31-4787-BF67-9D9ED0FF2B39" id="59EBFDED-2A31-4787-BF67-9D9ED0FF2B39" width="509" height="220"&gt;
  </code></pre>
  
  <p>The reason I have to do this is because this is a dynamically generated image and it needs to sit inside an email template.</p>
  
  <p><strong>EDIT</strong><br />
  <em>I'm beginning to think that this isn't possible. I've been researching for hours now and it looks like iOS won't let you attach an image and link to it via its CID. Thanks Apple</em> -_-</p>