I need some help with sending a formatted email. Below is my code.

I want "Comments:" string to appear in bold. How to do this in vb.net or C#

oBLL.Comments = "Comments:" + txtComments.Text

mailBody.Append(oBLL.Comments)
有帮助吗?

解决方案

What you need to do here is build your email body using HTML syntax and set MailMessage.IsBodyHtml property to true before sending.

oBLL.Comments = "<strong>Comments:</strong>" + txtComments.Text;

mailBody.Append(oBLL.Comments);

// ...

// assuming mail client and message instances already exists
mailMessage.IsBodyHtml = true;
mailClient.Send(mailMessage);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top