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
Here is how I embed images into email:
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("<img src='cid:{0}' alt='{1}' name='{1}' title='{1}' />", lr.ContentId, objimage.ImageName);
}
looking at this question: How to stop embedded images in email being displayed as attachments by GMail? - and comparing body of my email, it looks like i need to set Content-Type field to be
Content-Type: image/jpeg; name="my image name.png""
whereas currently my email looks like this:
----boundary_3_d581d04c-d294-4dc5-971e-785a678fbd12
Content-Type: image/jpeg
Content-Transfer-Encoding: base64
Content-ID: <Photo_1>
any idea how I can do this with C# and System.Mail?
Thanks.