title: Email: how to set a name of the embedded image in C# / System.Mail?
body: <p>I'm trying to send email with embedded images in it from C#. When I receive this email in Gmail, embedded images do not have proper names - instead, they are displayed as "noname" - see screenshot below</p>
  
  <p><img src="https://i.stack.imgur.com/9OOy6.png" alt=""></p>
  
  <p>Here is how I embed images into email:</p>
  
  <pre><code>foreach (var objimage in images)
  {
      var ms = new MemoryStream(objimage.ImageBytes);
      var lr = new LinkedResource(ms, MediaTypeNames.Image.Jpeg);
      lr.ContentId = "Photo_" + (++i).ToString();
      lstImages.Add(lr);
  
      body += string.Format("&lt;img src='cid:{0}' alt='{1}' name='{1}' title='{1}' /&gt;", lr.ContentId, objimage.ImageName);
  }
  </code></pre>
  
  <p>looking at this question: <a href="https://stackoverflow.com/questions/4040358/how-to-stop-embedded-images-in-email-being-displayed-as-attachments-by-gmail">How to stop embedded images in email being displayed as attachments by GMail?</a> - and comparing body of my email, it looks like i need to set Content-Type field to be</p>
  
  <p>Content-Type: image/jpeg; <strong>name="my image name.png"</strong>"</p>
  
  <p>whereas currently my email looks like this:</p>
  
  <pre><code>----boundary_3_d581d04c-d294-4dc5-971e-785a678fbd12
  Content-Type: image/jpeg
  Content-Transfer-Encoding: base64
  Content-ID: &lt;Photo_1&gt;
  </code></pre>
  
  <p>any idea how I can do this with C# and System.Mail?</p>
  
  <p>Thanks.</p>