我正试图用asp.net发送邮件,邮件地址是AegisImplicitMail。我的代码是:
string OggettoEmailIta = "Oggetto email";
string TestoEmailIta = "<p>aaa</p><br/><div>bbb</div>";
var mailMessage = new MimeMailMessage();
mailMessage.Subject = OggettoEmailIta;
mailMessage.IsBodyHtml = true;
mailMessage.Body = TestoEmailIta;
mailMessage.Sender = new MimeMailAddress("XXX", "XXX");
mailMessage.From = new MimeMailAddress("XXX", "XXX");
mailMessage.To.Add(new MimeMailAddress("XXX", "XXX"));
mailMessage.To.Add(new MimeMailAddress("XXX", "XXX"));
var emailer = new SmtpSocketClient();
emailer.Host = "smtp.XXX.XX";
emailer.Port = 465;
emailer.SslType = SslMode.Ssl;
emailer.User = "XXX";
emailer.Password = "XXX";
emailer.AuthenticationMode = AuthenticationType.Base64;
emailer.MailMessage.IsBodyHtml = true;
emailer.MailMessage = mailMessage;
emailer.SendMailAsync();
邮件已正确发送,但不是HTML格式。
有人能帮我吗?
最佳答案
您可以为html消息尝试字符串文本“@”,以便保留所有字符
string TestoEmailIta = @"<p>aaa</p><br/><div>bbb</div>";
关于html - AegisImplicitMail asp.net HTML正文电子邮件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41741173/