Email automation using pattern matching

Hi all, I am trying to automate an Email automation, where in I need to use pattern matching to match the pattern of Email and do the further operation.
Here are the scenario:::

1.Setup Crosswalk between Client name and destination folder
In config file, setup crosswalk between Client name and client folder
The client name column will contain name of client appear in payment file
The destination folder will be the client folder where the payment file to be moved for loading in server
Client Name Client Folder
ABC 12
xyz 22
DEF 55
VGF 98

The format of destination path for each of the above folder is,
<Client Folder>\NAME
The common path should be stored in config file and path in above format should be composed for each client folder

Step2: Access Email Inbox
Login to given email inbox
Read and process all the unread emails one by one

Step3: Open Unread Email
Read following unread emails one by one
a. Email sent by xyz@123.com
b. Subject starts with “Reports for”
Subject contains “From ”

Step4: Read Payment File Hyper Link
Read last line starting with “HTTPS” and ending with “.com”
This is a payment file hyperlink

Step5: Open Payment File Hyper Link
Open Payment file hyperlink in browser (CHROME/IE)
This will ask for credentials for logging in to xyz@123.com email inbox
Enter given credentials and click on “Ok”
This will open the payment email from inbox in browser

Step6: Download Payment File from Attachment
The opened payment email will have attachment file “Reports.zip”
Download the attached Report.Zip file in “download” folder

Please guide me to build this, Thanks in advance