Reputation: 833
I want to send image in Mail body not a attachment.
Here is my code.
MailMessage mail = new MailMessage();
mail.To.Add(new MailAddress(""toaddress"));
mail.Subject = strSubject;
mail.Body = "<html><body><img src=cid:companylogo/><br><p>Dear Member,</p>" + strBody + "<br/><b>Regards</b>,<br/>Team</body></html>";
mail.IsBodyHtml = true;
AlternateView altView = AlternateView.CreateAlternateViewFromString(mail.Body, null, MediaTypeNames.Text.Html);
LinkedResource logo = new LinkedResource("logo.jpg", MediaTypeNames.Image.Jpeg);
logo.ContentId = "companylogo";
altView.LinkedResources.Add(logo);
mail.AlternateViews.Add(altView);
SmtpClient client = new SmtpClient();
client.Send(mail);
Using this I am getting image as an attachment.
How I will send it as a Mail body?
Upvotes: 0
Views: 1670