To send an email from the application I'm using MailMessage
made available. Now I'm trying to put an image in the body of the email via html:
MailMessage mail = new MailMessage();
SmtpClient SmtpCliente = new SmtpClient(server);
...
mail.IsBodyHtml = true;
mail.Body += "<br />Cumprimentos,<br />";
mail.Body += "<img src=\"D://MediaOleotorres/logoOleotorresAssinatura.png\" height=\"42\" width=\"42\">";
However, when you send the email, the image does not appear. Do I have to use an image that is available online?
EDIT: I've also tried to put the image as attached and then add it to the body, is it possible?
string attachmentPath = @"D:/MediaOleotorres/imagens/logoOleotorresAssinatura.png";
Attachment inline = new Attachment(attachmentPath);
inline.ContentDisposition.Inline = true;
inline.ContentDisposition.DispositionType = DispositionTypeNames.Inline;
inline.ContentType.MediaType = "image/png";
inline.ContentType.Name = Path.GetFileName(attachmentPath);
mail.Attachments.Add(inline);