Hardcoding Text and formatting

Mark Fenech picture Mark Fenech · Oct 28, 2013 · Viewed 8k times · Source

I am sending an email with C# and hardcoding all the data needed for this to include in my Body.

However I need to change some fonts of some paragraphs(signature). I need to change the color of the signature to gray and changing the font size to a smaller size. Can this be done hardcoded?

mm.Body = "TEXT TEXT TEXT"+
"\r\n different font and color";

Answer

Ishan Jain picture Ishan Jain · Oct 28, 2013

Setting isBodyHtml to true allows you to use HTML tags in the message body:

msg = new MailMessage("[email protected]",
                "[email protected]", "Message from PSSP System",
                "This email sent by the PSSP system<br />" +
                "<b>this is bold text!</b>");

msg.IsBodyHtml = true;

Read this

And also try this :

msg.BodyFormat = MailFormat.Html;