2017-01-19 101 views
1

我想發送郵件在asp.net白色AegisImplicitMail。我的代碼是:AegisImplicitMail asp.net html正文電子郵件

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格式。 有人可以幫我嗎?

+0

嗨,你有沒有設法解決這個問題? – Stefan

回答

0

你可以試試字符串常量「@」爲您的HTML郵件,所以所有字符都保持

string TestoEmailIta = @"<p>aaa</p><br/><div>bbb</div>"; 
相關問題