Khusho
Khusho

Reputation: 25

How to set multiple colors of different parameters in email sent from C# project

I want to set the color of my text of the email which generate email by collecting data from different objects and parameters. I have code it but unable to set individual color of my context of each parameter

My code is given:

SmtpClient emailClient = new SmtpClient();

            MailMessage emailMessage = new MailMessage();
            emailMessage.IsBodyHtml = true;


                sbEmailBody.AppendLine("[" + **test.GetType().Name** + "]");

How can I set color of test.GetType().Name parameters?

Upvotes: 0

Views: 123

Answers (1)

Sachin
Sachin

Reputation: 40970

append the html text like this

<span style="color:red">My Text"</span>

as in your example

foreach (ITest test in tests)
{
  sbEmailBody.AppendLine("<span style='color:red'>[" + **test.GetType().Name** + "]</span>");
}

Upvotes: 1

Related Questions