MailMessage Mail = new MailMessage();
Mail.From = new MailAddress("balaji.birajdar@bogusdomain.com");
Mail.To.Add("balaji.birajdar@bogusdomain.com");
Mail.Subject = "This is Image Test.";
Mail.Body = "This is the body of the email";
LinkedResource LinkedImage = new LinkedResource(@"J:\My Documents\Advika1.jpg");
LinkedImage.ContentId = "MyPic";
AlternateView htmlView = AlternateView.CreateAlternateViewFromString("You should see image next to this line. <img src=cid:MyPic>", null, "text/html");
htmlView.LinkedResources.Add(LinkedImage);
Mail.AlternateViews.Add(htmlView);
SmtpClient smtp = new SmtpClient("111.111.111.111", 25);
try
{
smtp.Send(Mail);
}
catch (SmtpException ex)
{
throw ex;
}
.NET/C#