0
我想在郵件正文中發送圖像而不是附件。在郵件正文中發送圖像
這是我的代碼。
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);
使用此我得到圖像作爲附件。
我如何將它作爲郵件正文發送?