Email: how to set embedded image name in C # / System.Mail?

I am trying to send an email with embedded images to it with C #. When I receive this email in Gmail, the embedded images do not have their own names - instead, they appear as "noname" - see screenshot below

Here's how I embed images in an 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 displayed as GMail attachments? - and comparing the body of my letter, it looks like I need to set the Content-Type field to

Content-Type: image / jpeg; name = "my image name.png" "

whereas currently my email is as follows:

----boundary_3_d581d04c-d294-4dc5-971e-785a678fbd12
Content-Type: image/jpeg
Content-Transfer-Encoding: base64
Content-ID: <Photo_1>

, # System.Mail?

.

+3
3

, :

lr.ContentType.Name = "my image name.jpg";

html- , #

+3

IE  linkedResource = LinkedResource (src, MediaTypeNames.Image.Jpeg); //abbukmailer.com

0

Content-Disposition: attachment; fileName=<Your file name>

RFC

- simillar

-1

All Articles