2

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 <abc@outlook.com>
Sent: Monday, 5 October 2020 10:54 AM
To: BCD <bcd@outlook.com>
Subject: Files

Attached files

The password is: ABCDE

Akif
  • 7,098
  • 7
  • 27
  • 53
Jun Liang
  • 71
  • 1
  • 7
  • Welcome to SO. I have no idea what you mean. Could you explain what you mean with password form? – kwoxer Oct 08 '20 at 19:20

3 Answers3

1

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

Argeno
  • 11
  • 1
1

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.

Schpenn
  • 108
  • 1
  • 11
-1

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.

Akif
  • 7,098
  • 7
  • 27
  • 53