Example csv below to describe what I'm looking at doing
ID,Name,SupervisorName,SupervisorEmail,Action,Column5,Column6,Column7
123,Tim Jones,Sam Burk,sburk@somerandom.com,2,data,data,data
124,Mark Smith,Sam Burk,sburk@somerandom.com,2,data,data,data
125,Jill Jones,Tim Jones,tjones@somerandom.com,2,data,data,data
126,Sam Harris,Sam Burk,sburk@somerandom.com,3,data,data,data
127,Jana Lester,Lisa Jones,ljones@somerandom.com,2,data,data,data
I'm wanting to gather the data where the Action is 2 and the supervisor email is all the same and then send an email to the supervisor with the row data for each account they are associated with implying that an Action 2 event has been triggered.
Email being sent is based on the action. Need to group all of the rows for a given Supervisor's email for the given action and send one email per supervisor with multiple row data matching action 2.
It is a CSV of about 30k rows and each supervisor may have 5+ accounts that have a given event.
I want the output in the email to be something like:
Dear Sam Burk,
The below accounts have had the Action 2 performed on them. Please contact us with any concerns.
ID Name Action
123 Tim Jones 2
124 Mark Smith 2
126 Sam Harris 2
Regards,
Corporate Events
I'm assuming I would need a unique list of all supervisor emails that have the action of 2 associated to them. Any example code to do this?
I'm then assuming I would use the list and do a for each type statement to then gather all of the rows for the given supervisor with action 2 for the specific columns I need. Then compose the email with that data, send the email then go to the next one in the list... Any example code on how I would do this?
Do I use pandas to sort this? What is a good import / library to send emails to a SMTP gateway that requires authentication?
Powershell may be an option as well.
Thanks, Fred