Split From, To, Subject & Body of the Message stored in Data frame columns

Hello All,

I have a Dataframe looks like

EmailId → 1
Email_MSG →

"I just reviewed the form and this will need to be signed by the provider.
Thank you K!

--------------- Original Message ---------------
From: Sales North Team [sales_north@comp.com]
Sent: 4/12/2023 5:20 AM
To: customer@bcc.com
Subject: RE: New form needed

Great, thank you so much! I will follow up accordingly.

--------------- Original Message ---------------
From: KL [kl@comp.com]
Sent: 4/11/2023 10:04 AM
To: customer@bcc.com
Subject: RE: New Form Needed

Sorry about no pt info:

--------------- Original Message ---------------
From: KL [kl@comp.com]
Sent: 4/11/2023 9:06 AM
To: customer@bcc.com
Subject: New Form Needed

Hello KL,

Some Text 

Thank you!

I want split each Email(which is stored in Email_MSG column) into separate rows and their corresponding From and To email to the columns.

I tried Regex, Extract and Split lines none of them seems working for me!! Need an expertise advise here

What is the rule that will tell you, what the from/to emails etc. are? What logic should the program use to make this decision?

We can only possibly explain what is wrong with existing code, if we can see that code.

----Orginal Message— to ----Orginal Message ------ will be the rule to split texts and here is what I tried

> def parse_raw_email_message(raw_message,sr_id):
>    #lines = raw_message.Splitlines() Here the error Cannot apply splitlines on Sereis, Hence its in Dataframe
>    sr_id = sr_id
>    email = {}
>    message = ''
>    keys_to_extract = ['From', 'To']
>    print(sr_id) 
>    for line in lines:
>       if ':' not in line:         
>         message += line
>         sr_id = sr_id
>         email['body'] = message
>         email['sr'] = sr_id
>         email['concat'] = email['sr'].astype(str) + email['body']
>         nlp_su['sr_id'] = sr_id
>         nlp_su['mail_sep'] = email['concat'].replace("^.*--------------- Original Message ---------------","")
>       else:
>          pairs = line.split(':')
>          key = pairs[0].lower()
>          val = pairs[1].strip()
>          if key in keys_to_extract:
>             email[key] = val
>    return email,nlp_su
> sol = parse_raw_email_message(cust_email[0]['Email_Text'],cust_email[0]['ID'])
> print(sol)

This will give me Dict format, so that I can extract certain text after ----Orginal Message— and I am not sure this is right approach. Thanks for your help!!

Reason I Have added ID is each ID will have separate Mail conversations.