Click here to Skip to main content
15,507,388 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi All,

I have a scenario where i need to generate an automatic email from a website using it's APIs - It's done successfully. Now i want few field names as BOLD in the output. How to do that?

Below is my code:

STRBODY += "TaskID::" + a[GUIDCollection.TASK_TASKID_GUID].ToString() + "CategoryName: " + Category.Name.ToString() + " " + Status.Name.ToString();

TaskID: 1

I want
TaskID: Category

NOTE: I can't the email fucntionality so i am using LOG file to check the outputs. I am seeing the same font (unbold) in LOG file.
And i can see the HTML code also in the LOG file.

What I have tried:

I tried in adding HTML way but doesn't work.
Updated 9-Aug-16 5:47am
Kornfeld Eliyahu Peter 9-Aug-16 5:00am    
It is hard to see, how the code here (some logging) related to the email you are mentioning...
As HTML formatted email IS the solution for such problems you have, you should show your code us to see where things gone wrong...
Member 8010354 9-Aug-16 5:09am    
I have changed my question.
Kornfeld Eliyahu Peter 9-Aug-16 5:25am    
There is nothing HTML here so it is plain text (no bold)... How did you created the HTML?
Member 8010354 9-Aug-16 5:40am    
STRBODY += "<span style="font-weight:bold">TaskID:</span>" + a[GUIDCollection.TASK_TASKID_GUID].ToString() + ""<span style="font-weight:bold">Category</span>"+"CategoryName: " + Category.Name.ToString() + " " + Status.Name.ToString();
Kornfeld Eliyahu Peter 9-Aug-16 5:43am    
Now, that line not even compile!!!
You use quotes inside quotes without escaping them!!!

1 solution

Your sample HTML do not even compile...
Read about string literals (and how you can include string separator - double-quote - in string): String literals (C#)[^]
Escape Sequences[^]

A possible clean version of your line:
STRBODY += "<span style=\"font-weight:bold\">TaskID:< /span>" + a[GUIDCollection.TASK_TASKID_GUID].ToString() + "<span style=\"font-weight:bold\">CategoryName:< /span>" + Category.Name.ToString() + " " + Status.Name.ToString();
Share this answer
Maciej Los 9-Aug-16 10:48am    
Kornfeld Eliyahu Peter 9-Aug-16 12:57pm    
Thank you...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900