baby-tux wrote:
I'd like to extract the body and the subject of some mail from spool's mail (I use fetchmail to get them) is a bash script,
I suppose this is a difficult thing to do right in a small bash script. Your script should be aware of such things as MIME, transfer encoding, character sets etc… There is a lot of technical details to take care of.
In practice, I think, almost any automatic processing of messages may be done in mail delivery agent (mail filter) software, like procmail or maildrop. They also allow running custom scripts.
The other way to go is using scripting languages (python, perl, ruby) where the powerful libraries take care of the details. After little googling I have found a simple script in python which prints message bodies. You may find the script
here.