Jim Osborn <jimo(_at_)eskimo(_dot_)com> writes:
Maybe the heat has melted my brain, but I can't seem to get formail
to perform a series of commands on each mail that it's split from
a folder. Here's an example of a simple debugging attempt:
formail -s addr=`formail -X From: | formail -r | formail -zx To`;\
echo "$addr" >>output
I've tried parentheses, putting the commands into a shell function,
and other flailings too numerous to remember, all to naught.
Could someone please explain how this can be done?
It appears that formail doesn't use the shell when executing the command
specified when splitting. No SHELLMETAS here. Given that, the secret is
to fire up the shell explicitly yourself to do the piping:
formail -s sh -c 'formail -XFrom: | formail -rzxTo:' >> output
Note that you only need two formails in the pipe, not three, as the
-r flag works correctly when combined with other flags.