I am trying to add an image to an email in ASP.NET MVC, I got this following code which does send the email, but the image does not appear initially, I have to open the email, close it and open it again, What Am I doing wrong?
var message += "<img src='https://chart.googleapis.com/chart?chs=250x250&cht=qr&chl=abc%20123%20456&choe=UTF-8' />";
using (SmtpClient client = new SmtpClient("xxx.xxx.x.xx"))
{
MailAddress to = new MailAddress("john@example.com");
MailAddress from = new MailAddress("email@example.com");
MailMessage email = new MailMessage(from, to);
email.Subject = "Subject";
email.Body = message;
email.IsBodyHtml = true;
try
{
client.Send(email);
}
catch (Exception ex)
{
Console.Write(ex);
}
}