Looped Mail Reading

Hello Guys,

I have a process in which i want to read the outlook mail.

in that mail there will be looped mail,

i want to read the content(Date send or received)of looped mail.

how can i do that

Hi @Gokul_Murali

after reading the mail-
Assign the body to a string
mailBody = item.Body

then use regex to find all dates in the thread
foundDates (IEnumerable) = System.Text.RegularExpressions.Regex.Matches(mailBody, “(?<=Sent:\s).(?=\r?\n)|(?<=Date:\s).(?=\r?\n)”)

Access specific loop (e.g., the first reply)
firstLoopDate = foundDates(0).Value

Change Variable / req. accordingly…

Happy Automation

Hi @Gokul_Murali

After Get Outlook mail message activity use the following expressing in assign

sentDate = mail.Headers(“Date”)
receivedDate = mail.Headers(“Received”)

This works even if the email is part of a thread / looped mail.

@Gokul_Murali

Can you show a sample input and output how you want it.

@ashokkarale

I have sent you a mail today with mail body Status - Success

After 2 days you replay back to that mail with mail body Status - It is Pending.

Then again after one day i replayed the same mail to you saying Status - Failed.

Now here i want to track the mail dates of first mail i send to you , the second mail date you replayed it to me and the 3rd mail i date i replayed to back.

And the content of the mail i send you replayed.

I have already developed a process for this but in that it only read the final mail date received, content of the mail etc. but will not read the looped mail content

@Gokul_Murali

With the current logic you will get the latest email timestamp. To get all the remaining timestamps in the email conversation, you can use Regex to extract Sent date.

Use this regex for it.

^Sent:\s*(.+)$

This will give you all the dates from the email body.

In Microsoft Outlook, use conversation threading.
Get the conversation (ConversationID / GetConversation), loop through mails, and read SentOn or ReceivedTime.