title: Send email to gmail with inline images and MIME::LITE
body: <p>I need to send an email to gmail with some inline images.</p>
  <p>I use perl and MIME:LITE, but Gmail shows my image as Attachment, not inline.</p>
  <p>What's the problem?</p>
  <p>This is my code,</p>
  <pre><code>use MIME::Lite;
  
  my $texto = '&lt;html&gt;&lt;body&gt;hola &lt;img src=&quot;cid:image&quot; /&gt; adios &lt;/body&gt;&lt;/html&gt;';
  
  #
  my $msg = MIME::Lite-&gt;new(
      Date            =&gt; &quot;Xxx, 22 Oct 2012 17:45:00 CET&quot;,
      From            =&gt; &quot;pruebachunga@aqui.com&quot;,
      To              =&gt; 'chimpun@forum.chimpun',
      Subject         =&gt; &quot;En un lugar de la mancha&quot;,
      'Message-ID'    =&gt; '123456789012345656789@8888888888888ldkf',
      Type            =&gt;'multipart/related'
  );
  
  $msg-&gt;attach(
      Type =&gt; 'text/html',
      Data =&gt; $texto,
      Encoding =&gt; 'quoted-printable'
  );
  
  $msg-&gt;attach(
      Encoding =&gt; 'base64',
      Type =&gt; 'image/png',
      Path     =&gt; &quot;image.png&quot;,
      Id =&gt; &quot;image&quot;
  );
  
  $msg-&gt;scrub(['x-mailer', 'Content-Disposition']);
  
  print $msg-&gt;as_string;
  </code></pre>
  <p>The result is this email (I strip image secction)</p>
  <pre><code>Content-Transfer-Encoding: binary
  Content-Type: multipart/related; boundary=&quot;_----------=_135100636840600&quot;
  MIME-Version: 1.0
  Date: Xxx, 22 Oct 2012 17:45:00 CET
  From: pruebachunga.com
  To: chimpun@forum.chimpun
  Subject: En un lugar de la mancha
  Message-Id: 123456789012345656789@8888888888888ldkf
  
  This is a multi-part message in MIME format.
  
  --_----------=_135100636840600
  Content-Transfer-Encoding: quoted-printable
  Content-Type: text/html
  
  &lt;html&gt;&lt;body&gt;hola &lt;img src=3D&quot;cid:image&quot; /&gt; adios &lt;/body&gt;&lt;/html&gt;=
  
  --_----------=_135100636840600
  Content-Id: &lt;image&gt;
  Content-Transfer-Encoding: base64
  Content-Type: image/png; name=&quot;image.png&quot;
  
  iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAMAAAEwO1XwAAAAB3RJTUUH1gYE
  ...
  kmqg1wGgkx35p/KStnLuw2BGhXwIZqT+D8sxTLVK0VpuAAAAAElFTkSuQmCC
  
  --_----------=_135100636840600--
  </code></pre>
  <p><strong>EDIT</strong>:</p>
  <p>After reading on the web, I think that image is an attachment and has a problem known as &quot;Image Blocking&quot;: <a href="https://www.campaignmonitor.com/resources/guides/image-blocking-in-email/" rel="nofollow noreferrer">https://www.campaignmonitor.com/resources/guides/image-blocking-in-email/</a></p>
  <p>I maintained my question because people may find this question interesting. Now, I think that this code is correct, and with the other message, other ID, other sender... this code can run well.</p>