2016-10-13 8 views
0

私はASP.NET MVC System.Net.Mailでメールを送信していますが、メール本体にはHTMLタグ<strong></strong>がありますが、メールを送信すると、そのテキストは次のようになりますこの<strong>MESSAGE</strong>の代わりに、太字でこれを修正するにはどうすればよいですか?ここでASP.NET MVC System.Net.Mail <strong></strong>

は私のコードです:

var message = "<strong>MESSAGE</strong>\n\n"; 
MailAddress to = new MailAddress([email protected]); 
MailAddress from = new MailAddress("[email protected]"); 
MailMessage email = new MailMessage(from, to); 
email.Subject = "Subject Line"; 
email.Body = message; 
email.BodyEncoding = System.Text.Encoding.UTF8; 
SmtpClient client = new SmtpClient("mail.example.com"); 
+0

あなたは何かが.NET作品に組み込まれている方法についての質問がある場合は、[関連をチェックしますドキュメント](https://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage(v = vs.110).aspx)を参照してください。 – mason

答えて

3

あなたはtrueIsBodyHtmlフラグを設定する必要があります。

email.IsBodyHtml = true; 
関連する問題