Mailtextbody reads a complete email message on stdin and returns the body on stdout. Technically speaking, it returns the first decoded text/plain MIME part of any (however nested) MIME message or just the body of a non-MIME message otherwise.
Mailtextbody can easily be included in other tools using pipes.