Click here to Skip to main content
15,917,709 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hii everyone please help about this

How can search to find especial text from body of email such " best regards"
Posted

1 solution

Depends if you use outlook or webmail.
For Outlook you can use this code to read from the inbox:

C#
Outlook.Application outlook = new Outlook.ApplicationClass();
Outlook.NameSpace ns = outlook.GetNamespace("Mapi");
Outlook.Recipient oRecip = ns.CreateRecipient("INBOX");
oRecip.Resolve();
if (oRecip.Resolved)
{
                    Outlook.MAPIFolder oInbox = ns.GetSharedDefaultFolder(oRecip,                 Outlook.OlDefaultFolders.olFolderInbox);
                    
                    if (oInbox.Items.Count > 0 && oInbox.Items.Count != null)
                    {
                        for (int i = 1; i <= oInbox.Items.Count; i++)
                        {
                           
                            if (oInbox.Items[i] is Outlook.MailItem)
                            {
                                Outlook.MailItem mailItem = oInbox.Items[i] as Outlook.MailItem;
                                ProcessMailItem(mailItem);
                                mailItem.UnRead = false;
                            }
                            

                        }
                    }
                    if (strRTFMessage != null)
                    {
                        ///
                    }
                    else
                    {
                        strRTFMessage = "<no emails="" available="">";
                        ////
                    }
                }
</no>


You can then save that email as a normal Textfile and do a search line by line using streamreader for example

Hope that helps
 
Share this answer
 

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