forward event in outlook with c#

  • Thread starter Thread starter Nagaraj
  • Start date Start date
N

Nagaraj

Hi All,

I have some text (original message) as follows

<i>please see below. i will send another one where its coming on top of the
email</i>

I am capturing this text in the mail_forward event in a string

I added some more text (<b>current text</b> which is combination of original
message and some more new text)

In the Item_Send event I want to know the index of original message in the
current text.

The problem is when I print current text it is as follows



<div>

<p class=MsoNormal>please see below. i will send another one where its
coming on top of the email<o:p></o:p></p>

</div>


from where these extra lines and <p> tags <o:p> tags are coming? for this
reason
I am unable to find original message in the current text. i.e. I want to
find the index of original message in the new text. Can anyone tell me how to
do this in c#

Thanks
 
Outlook will rewrite your HTML so you can't depend on it remaining exactly
as you set it. We went through this before if I'm not mistaken. You just
look for your string as a substring of the HTMLBody property to get where it
starts. If you want the index of where a <div> tag starts then get your text
index and work backwards from there.

There are a limited number of ways that Outlook will rewrite your text,
depending on Outlook version and whether or not WordMail is enabled. Those
are all properties you can check at runtime. If you get the pattern of how
the HTML is rewritten on each permutation of Outlook/WordMail you intend to
support you can use that information to know what to look for in that
specific case.
 
Back
Top