How can i get the body data from Gmail

Hi @muta,

using Build Data Table create a table (From,Company,Telephone,MessageBody)

  • Use Get IMAP Mail Messages Activities, and get unread mails
  • Use For Each Activity and get Body data → strMailContent
  • Use Matches activity to get the all the details

From Value:
Use Matches activity
Properties
Input : strMailContent
Pattern : ((?<=From:).*(?=Company:))
Result: iEnumResult → IEnumberable<Match>
after that use assign activity to get the data
strFrom=iEnumResult (0).ToString()

Company Value:
Use Matches activity
Properties
Input : strMailContent
Pattern : ((?<=Company:).*(?=Telephone:))
Result: iEnumResult → IEnumberable<Match>
after that use assign activity to get the data
strCompany=iEnumResult (0).ToString()

Telephone Value:
Use Matches activity
Properties
Input : strMailContent
Pattern : ((?<=Telephone:).*(?=Message Body:))
Result: iEnumResult → IEnumberable<Match>
after that use assign activity to get the data
strTelephone=iEnumResult (0).ToString()

MailBody Value:
Use Matches activity
Properties
Input : strMailContent
Pattern : ((?<=Message Body:).*)
Result: iEnumResult → IEnumberable<Match>
after that use assign activity to get the data
strMailBody=iEnumResult (0).ToString()

Now you got the four values into datarow.
using write range activity write the data in the excel file.

Regards,
Arivu :slight_smile:

2 Likes