CID image embeds are not loading properly in Outlook but load properly in Gmail
We are using CID to load the images, but the images won't load in outlook, we are using IFluentEmail.
var attachments = new List<Attachment>();
// Set image src then Get image src for email purpose
htmlNode.SetAttributeValue("src", $"cid:{imgIndex}");
template = template.Replace(imgHtml, htmlNode.OuterHtml);
attachments.Add(new Attachment
{
ContentId = imgIndex,
Data = new MemoryStream(Convert.FromBase64String(src.Split(";base64,")[1])),
ContentType = "image/jpeg",
Filename = $"c2p-img-{imgIndex}",
});
var templateLayout = $@" @model {model.GetType().FullName}
{template}";
sendEmailTo = recipientEmail?.Address?.ReplaceEmptyString() ?? bccEmailAddress.Address.ReplaceEmptyString();
email.FEmail.To(sendEmailTo)
.Subject(subject)
.Attach(attachments)
.UsingTemplate(templateLayout, model);