I am currently working on a message watcher service we have and my task is to simply embed message details into the message body.
I have tried using a string builder for this however i have found that my message body is a html based string.
I'm wanting to know if there is a way i can add the values i want to add at a certain point in this html string?
Below is a section of the html string i want to manipulate. My text needs to be inserted directly after the body tag.
<body lang=EN-GB link=blue vlink=purple>
<div class=WordSection1>
<p class=MsoNormal>
<span style='font-size:10.0pt;font-family:"Century Gothic","sans-serif";color:black'>Another test for AppendLine();<o:p></o:p>
</span>
</p>
Here is how i was trying to do it:
StringBuilder sb = new StringBuilder();
sb.Append("From: ");
sb.Append(message.From.ToString());
sb.AppendLine();
sb.Append("Sent: ");
sb.Append(message.Date.ToString());
sb.AppendLine();
sb.Append("To: ");
sb.Append(message.To.ToString());
sb.AppendLine();
sb.Append("Subject: ");
sb.Append(message.Subject);
sb.AppendLine();
sb.Append(message.BodyHtml);
Unfortunately this just printed my From, Sent, To, Subject values onto one line and then output the html section.
If any more information is needed please let me know and i will provide it.