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 = AlternateView.CreateAlternateViewFromString(strBody, null, MediaTypeNames.Text.Html);
logoHeader= new LinkedResource("some xyz.com");
logoHeader.ContentId = "logoimage";
av1.LinkedResources.Add(logo);
string image = "example.com/image.jpg";
var webClient = new WebClient();
byte[] imageBytes = webClient.DownloadData(image);
MemoryStream ms = new MemoryStream(imageBytes);
LinkedResource resource = new LinkedResource(ms, MediaTypeNames.Image.Jpeg);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With