Question

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)
Était-ce utile?

La solution

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);
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top