1

I want to send an email with some attached images. I also need to show these images in Email. How can I get the link of these attached email so that I can show them in email.

Note: I can also use remote images, but email servers like yahoo, gmail and hotmail will put them in spam.

Is this is possible in ASP.NET or ASP.NET MVC?

rick schott
  • 21,012
  • 5
  • 52
  • 81
Imran Qadir Baksh - Baloch
  • 32,612
  • 68
  • 179
  • 322

1 Answers1

1

Take a look at this question with a solution using the AlternateView class:

sending mail along with embedded image using asp.net

string html = @"<html><body><img src=""cid:YourPictureId""></body></html>";
AlternateView altView = AlternateView.CreateAlternateViewFromString(html, null, MediaTypeNames.Text.Html);

LinkedResource yourPictureRes = new LinkedResource("yourPicture.jpg", MediaTypeNames.Image.Jpeg);
yourPictureRes.ContentId = "YourPictureId";
altView.LinkedResources.Add(yourPicture);

MailMessage mail = new MailMessage();
mail.AlternateViews.Add(altView);
Community
  • 1
  • 1
rick schott
  • 21,012
  • 5
  • 52
  • 81