You use the email:parts() method to extract the parts of the letter. In multi-page email you will have both text / html and text / simple parts.
To access your email, first extract the email (in the form of RFC822) from the msg event parameter, for example:
envelope = event:param("msg");
Then you can use the parts method to extract the parts. This code example retrieves a portion of plain email text:
textportion = email:parts(envelope,"text/plain").pick("$..text/plain");
Calling email:parts(envelope) without passing a filter mime returns a structure with all parts of the email.
Once you have the body, you can use textportion.extract(re//) to extract information from the body of the email.
source share