How can I attach an image in a telephoto object. I wrote the code below
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(); string UserName = " xyz@someorg.com "; string Password = "my password"; message.To.Add(new System.Net.Mail.MailAddress(" toaddress@toadddress.com ")); message.From = new System.Net.Mail.MailAddress(" fromaddress@fromaddress.com "); message.Subject = "test subject"; message.Body = "<img src=@ 'C:\\Sunset.jpg'/>"; message.IsBodyHtml = true; System.Net.Mail.SmtpClient smtpClient = new System.Net.Mail.SmtpClient(); smtpClient.Host = "hostname"; smtpClient.Port = 25; smtpClient.Credentials = new System.Net.NetworkCredential(UserName, Password); smtpClient.Send(message);
The code is fine, as I get the message, but the image goes like [X] inside the body, not like the image. How to solve this? The right way?
c #
priyanka.bangalore
source share