我正在尝试将图像添加到ASP.NET MVC中的电子邮件中,我得到以下代码,它确实发送了电子邮件,但图像最初没有出现,我必须打开电子邮件,关闭它并打开它再一次,我做错了什么?
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);
}
}