Re: mailItem.HTMLBody should retrieve only current text

Status
Not open for further replies.
T

TmFnYXJhag

Hello Ken,

I have the following text in the original text within the body

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

the email.</div><div><br></div><div>raghu</div><div style="font-family:times

new roman, new york, times, serif;font-size:12pt"><br><div

style="font-family:times new roman, new york, times,

serif;font-size:12pt"><font size="2" face="Tahoma">----- Forwarded Message

----<br><b><span style="font-weight: bold;">From:</span></b> Steve Waterhouse

<steve@predictiveresults.com><br><b><span style="font-weight:

bold;">To:</span></b> raghu@aatmani.com<br><b><span style="font-weight:

bold;">Sent:</span></b> Thursday, March 5, 2009 3:22:01 PM<br><b><span

style="font-weight: bold;">Subject:</span></b> FW: test<br></font><br
new text message contains

<div class=Section1
<p class=MsoNormal><span

style='font-size:11.0pt;font-family:"Calibri","sans-serif";

color:#1F497D'>fwd<o:p></o:p></span></p
<p class=MsoNormal><span

style='font-size:11.0pt;font-family:"Calibri","sans-serif";

color:#1F497D'><o:p> </o:p></span></p
<div
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in

0in'
<p class=MsoNormal><b><span

style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span

style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> sridhar

[mailto:info@ramana.com] <br
<b>Sent:</b> Friday, March 06, 2009 2:36 AM<br
<b>To:</b> Nagaraj<br
<b>Cc:</b> Vikram Rayabhari<br
<b>Subject:</b> Fw: test<o:p></o:p></span></p
</div
</div
<p class=MsoNormal><o:p> </o:p></p
<div
<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
<div
<p class=MsoNormal><o:p> </o:p></p
</div
My problem is I am unable to search the text in the original text

<div>please see below. i will send another one where

in the new message text because in the new text <p class=MsoNormal> tag is

attached to the modified text as follows

<div
<p class=MsoNormal>please see below. i will send another one where its coming

Can you suggest me how to get the index of 'please see below' in the new

message text

Thanks

Nagaraj Tadipatri
wrote:


> You will have to do what I said, any code I have for something like that is
> so customized for specific clients it wouldn't do you much good. Find the
> original text within the <body> </body> tags and the new text in the reply
> message and find where the new text was added to the old text. You might
> also have to parse the text to remove any existing signatures if they are
> present in the text.

> >

>

> "Nagaraj" <nagaraj.tadipatri@gmail.com> wrote in message
> news:F300332A-DD25-42AB-AFD4-59CC56B872D3@microsoft.com...
> > Thank you Ken for your reply.
> > My actual requirement is I already have some message replied to me.
> > Whenever
> > I reply back to him I want to display (company signature) immediately
> > after
> > new text which i reply to him.
> > But what is happening is the signature is displayed after entire text
> > (current text and previous message).
> > My current code
> > mailItem.HTMLBody = mailItem.HTMLBody + adContent.text;
> > where adContent.text is the company signature.
> > My requirement is i want to display company signature immediately after my
> > reply text but not at end of entire message( current + previous messages).
> > Do
> > you have any C# code to do this?
> > Thanks
> > is
> > > > Nagaraj Tadipatri


>
 
If you are specifically looking for "please see below" then it's easy to

find that text.

Outlook will rewrite your HTML, and how it's rewritten depends also on what

email editor is being used. If necessary you have to experiment with that

and possibly set up different tests depending on whether or not WordMail is

being used and what version of Outlook the code is running on.

One trick you can use is to get the text without all the HTML tags by

reading the Body property to get the plain text equivalent. That makes it

easier to find the end of the previous message, once you have that you can

search for the equivalent text in the HTMLBody. Then you apply logic that

starts at that position and works backwards or forward to find the enclosing

tags for that section.
 
Last edited by a moderator:
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
S ->[O2007] Parsing each line of a MailItem HTMLBody? Outlook VBA and Custom Forms 2
V Setting HTMLBody of new mailItem Outlook VBA and Custom Forms 1
P MailItem.To Property with VBA not work Outlook VBA and Custom Forms 2
G Event when creating task from mailitem Outlook VBA and Custom Forms 2
A Run-time error '430' on certain emails when trying to set "Outlook.mailitem" as "ActiveExplorer.Selection.Item" Outlook VBA and Custom Forms 2
U Outbox Message Stuck after reading some MailItem Properties with VBA Outlook VBA and Custom Forms 1
oliv- Best practice for catching mailitem.events Outlook VBA and Custom Forms 0
oliv- How to select an mailitem in explorer with "show as conversation" Outlook VBA and Custom Forms 8
JorgeDario How to capture and save the text, when responding a MailItem? Outlook VBA and Custom Forms 3
JorgeDario how to check a MailItem has a digital signature (SMIME) with vba? Outlook VBA and Custom Forms 1
JorgeDario ¿What property of mailitem can be used like primary key? Outlook VBA and Custom Forms 6
S Outlook VBA rule script to process both MailItem and MeetingItem Using Outlook 0
B right click outlook objects in OL2010 acts on current inbox mailitem Using Outlook 6
C MailItem Find method doesn't work Using Outlook 0
C MailItem.SaveAs not working Outlook VBA and Custom Forms 10
G RE:The signature is also inserted if you touch the MailItem. Outlook VBA and Custom Forms 1
B Add signature to MailItem Outlook VBA and Custom Forms 3
C How can I create a new MailItem inside a user folder? Outlook VBA and Custom Forms 4
S Create a new Outlook MailItem in an Outlook folder(not a draft) Outlook VBA and Custom Forms 2
A How to get OOM MailItem Raw data Outlook VBA and Custom Forms 2
S Saved Property of MailItem is copied Outlook VBA and Custom Forms 1
S MailItem Find Method question Outlook VBA and Custom Forms 6
N Getting the attachments in MailItem Outlook VBA and Custom Forms 1
T How to get MailItem.Body without security warning in Outlook 2010 Outlook VBA and Custom Forms 2
T How to get Inspector or MailItem from wordEditor Outlook VBA and Custom Forms 6
A Select the position of an attached file in a HTML mailitem Outlook VBA and Custom Forms 1
M MailItem object has no property for when a reply was sent Outlook VBA and Custom Forms 3
B Insert information to MailItem Outlook VBA and Custom Forms 1
E Properties added to MailItem in ItemSend event visible to recipien Outlook VBA and Custom Forms 1
V How to find mailitem in the inspector is a brand new one Outlook VBA and Custom Forms 2
M Activate "Add digital signature to this massage" on a MailItem? Outlook VBA and Custom Forms 1
K importing EML in MailItem Outlook VBA and Custom Forms 1
A mailitem Send issue Outlook VBA and Custom Forms 5
M Get email address from MailItem.To? Outlook VBA and Custom Forms 6
S UserProperties of MailItem object. Outlook VBA and Custom Forms 3
R How to capture a Mailitem Event Outlook VBA and Custom Forms 3
S get current position in message body of mailitem Outlook VBA and Custom Forms 8
S How to get RFC822 format message from the MailItem object. Outlook VBA and Custom Forms 4
J Toolbar button to process current mailitem Outlook VBA and Custom Forms 1
D MailItem from an RSS feed Outlook VBA and Custom Forms 2
J Outlook 2007 crashed when pushing send on a displayed mailitem Outlook VBA and Custom Forms 1
N Memory with MailItem.Send Outlook VBA and Custom Forms 1
P Adding a button in a mailitem Outlook VBA and Custom Forms 1
S Reading mailitem after mail is send give runtime error. Outlook VBA and Custom Forms 1
D Max. length of MSO MailItem.EntryID Outlook VBA and Custom Forms 6
R MailItem.Display() error Outlook VBA and Custom Forms 1
R Clone mailitem Outlook VBA and Custom Forms 5
R MailItem Outlook VBA and Custom Forms 2
D Length of the MailItem.EntryID Outlook VBA and Custom Forms 2
M What is the recommendet way to read/write a user defined Field (Named Property) in the MailItem Obje Outlook VBA and Custom Forms 1

Similar threads

Back
Top