Extract specific data from get mail activity using Imap mail message

Hello All,

I want to extract specific data from my body of the mail.

Here my example data:

Sender: Test Subject, test@gmail.com
Subject: Register For The Data Science
Recipients: receipients@gmail.com
Recipients: relceipients1@gmail.com
To: test1@gmail.com

I want to extract sender and subject differently and I need to store values in .csv.

If I will use matches comment getting the values only true and false, But I need the exact value to store.

Any help on this!

I am using the below command option to get each line.

But, I am receiving the output system.string.

Any guide??

@yogavalli I don’t think you need to Split and Iterate over the array to get the Value, you can use Regex in the following way using an Assign Statement :

senderValue = System.Text.RegularExpressions.Regex.Match(mail.Body,“(?<=Sender:).*”).Value

subjectValue = System.Text.RegularExpressions.Regex.Match(mail.Body,“(?<=Subject:).*”).Value

3 Likes

Hello @supermanPunch,

It’s been long time, Nice to meet you again.

I have tried same condition, but the output is empty, and here why we are using .value?

Any help?

Hi @yogavalli Nice to meet you too. The .Value is just to convert it to a String type. Since that Expression results in a Match Type. You can Check the Regex in the below link. It is able to extract the Sender and Subject Value. If it is Still not able to Extract then I request you to Debug or use a Message Box and Check the mail content format if it is in the Proper order.

2 Likes

Hi @supermanPunch.

Yes, I have issue to get body of the mail, Now i am using mail.Headers(“HTMLBODY”).

I am able to get the output.

Thank you once again :grinning:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.