简体   繁体   中英

OpenPoup.NET - find email, subject and date from forwarded message - C#

I am using OpenPoup.NET to read email from Gmail. I want to identify original sender, receiver, date and subject of forwarded message. My email looks like,

----------------------Email Body starts-----------------------------------

FYI, read below email to get idea of button.

Chirag Developer XYZ Limited

From: Rat Chanra [mailto:rat@chanra.com] Sent: Friday, June 5, 2015 9:48 PM To: Chirag Subject: FW: Copy Product Button

Hi Rat,

I have included a .png of the copy product button. Attached also is an .eps of updated buttons if we feel like updating all the buttons!

Let's chat,

Ali Designer

----------------------Email Body Ends-----------------------------------

I want to find From, Date, Sublect and To of original message, which is in this case,

From = rat@chanra.com
Date = Friday, June 5, 2015 9:48 PM
To = Chirag
Subject = FW: Copy Product Button 

Can I do this using OpenPopUp.net?

Do I have to parse email body using RegEx and fetch above detail. If yes, what is best way for that? I am using C#

You can use the following to match:

From:\s+[^[]+\s+\[mailto:([^\]]+)\]\s+Sent:\s+(\w+,\s+\w+\s+\d+,\s+\d{4}\s+[\d:]+\s+[aApP]M)\s+To:\s+(\w+)\s+Subject:\s+(.*)

And extract From as $1 , Date as $2 , To as $3 and Subject as $4 .

See DEMO

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM