Is there a free open-source solution taking raw e-mail message (as a piece of text) and returning each header field, each attachment and the message body as separate fields?
Yes... For each language you pointed out, I've used the one in Python myself.  Try perusing the library documentation for your chosen library.
(Note: You may be expecting a "nice", high-level library for this parsing...  That's a tricky area, email has evolved and grown without much design, there are a lot of dark corners, and API's reflect that).
Is there an open-source eMail message (headers, attachments, etc.) parser?