0
我正嘗試從my.net應用程序發送電子郵件。 我已經在其中包含一個圖像。我在電子郵件中獲得圖像。問題是圖像也作爲附件來臨。 我只需要內嵌圖像。不附件。任何刪除附件的選項? 我有包括從以下兩個選項中任一項下面C#。如何在發送郵件時避免附加圖像
body = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">";
body += "<HTML><HEAD><META http-equiv=Content-Type content=\"text/html; charset=iso-8859-1\">";
body += "</HEAD><BODY><DIV><FONT face=Arial color=#ff0000 size=2>this is some HTML text";
body += "</FONT></DIV><DIV><img width=600 height=100 id=\"_x0000_i1028\" src=\"cid:cid1\" alt=\"KPMG LINK\"></DIV></BODY></HTML>";
AlternateView alternate = AlternateView.CreateAlternateViewFromString(body, null, "text/plain");
AlternateView alternateHtml = AlternateView.CreateAlternateViewFromString(body, null, "text/html");
LinkedResource resource = null;
resource = new LinkedResource(ImagePath, new ContentType("image/png"));
resource.ContentId = "cid";
alternate.LinkedResources.Add(resource);
message.AlternateViews.Add(alternate);
message.AlternateViews.Add(alternateHtml);
smtp.Send(message);