image url in linked resource

前端 未结 2 1159
栀梦
栀梦 2021-01-21 05:36

I want to embed a image from an url in c# mail, I tried using this code but it is not working

 LinkedResource logoHeader = null;
AlternateView av1 = AlternateVie         


        
2条回答
  •  无人共我
    2021-01-21 06:07

    AlternateView av = AlternateView.CreateAlternateViewFromString(str,null,MediaTypeNames.Text.Html);
    LinkedResource lr = new LinkedResource("E:\\Photos\\hello.jpg",MediaTypeNames.Image.Jpeg);
    lr.ContentId = "image1";
    av.LinkedResources.Add(lr);
    message.AlternateViews.Add(av);
    

提交回复
热议问题