How do i extract text from email body using UiPath?

4.3k views Asked by At

I would like to know how do I extract the password form the email body. The password is used to open files in the attachment. How should I approach this? Do I extract the password and store it in an excel file or is there a better way to open the file and store the data.

Below is an example email

Example email
From: ABC <[email protected]>
Sent: Monday, 5 October 2020 10:54 AM
To: BCD <[email protected]>
Subject: Files

Attached files

The password is: ABCDE

3

There are 3 answers

0
Schpenn On BEST ANSWER

Assuming the password is always 5 characters long, you could get the email body and split it like this:

split(emailBody, "The password is:", 5)

enter image description here

enter image description here

You could then store the output in a variable to be used when opening the excel file.

0
Akif On

There may be different passwords to open the encrypted files and login to email. So there should be passwords for each encrypted file. You can store them in any way.

0
Argeno On

Just request the mails, once you have the MailMessage object use the method 'body' to access to it as a string. Then you could capture the password with RegEx or other approach