How to Dynamically Reply Email Back to Sender and Other Put in cc?

Hi.

Let’s say that I have a list of multiple people (say A, B, C, D, E, and so on). They can email at anytime and I will process file from their email (using orchestrator). I want to make it like this

Sender sends the email → RPA process it → RPA reply to sender

How to make it dynamically so that
if A is the sender of an email, A will be put on To and B,C,D,E,etc will be put on cc
If B is the sender of an email, B will be put on To and A,C,D,E,etc will be out on cc
and so on…

What is the best and simple way to do that? I am thinking that I should store the name of the sender and the filename on the beginning and load it again at the end but it seems like too much work and I feel there must be another simpler way

Thanks in advance for the help

The best thing we can do is, saving all the mails in an array and while reading, store the mail id of the user. then while sending, the mail id of the user should be in TO and loop through the array and skip the TO mail id while adding in CC list