Send inline image in email

Some minimal c# code to embed an image, can be: MailMessage mailWithImg = GetMailWithImg(); MySMTPClient.Send(mailWithImg); //* Set up your SMTPClient before! private MailMessage GetMailWithImg() { MailMessage mail = new MailMessage(); mail.IsBodyHtml = true; mail.AlternateViews.Add(GetEmbeddedImage(“c:/image.png”)); mail.From = new MailAddress(“yourAddress@yourDomain”); mail.To.Add(“recipient@hisDomain”); mail.Subject = “yourSubject”; return mail; } private AlternateView GetEmbeddedImage(String filePath) { LinkedResource res = new LinkedResource(filePath); … Read more

How to display Base64 images in HTML

My suspect is of course the actual Base64 data. Otherwise it looks good to me. See this fiddle where a similar scheme is working. You may try specifying the character set. <div> <p>Taken from wikpedia</p> <img src=”data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUA AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO 9TXL0Y4OHwAAAABJRU5ErkJggg==” alt=”Red dot” /> </div> You can try this Base64 decoder to see if your Base64 … Read more