Ron Parker asked,
| I am trying to figure out how to create a recipe which will do the
| following:
|
| 1. save single message received to a unique filename
| 2. execute perl script using that file name as parameter
| 3. delete the file after execution of perl script
Phil Edwards's solution was to set TMPFILE=/tmp/$USER.$$.procmail
to get a unique name; my inclination was to let procmail pick it out.
I would set WORKSPACE to the path (relative from $MAILDIR or, better yet,
absolute) to a directory and proceed as follows:
:0
* conditions for these actions
{
# no need for the extra work to get an MH-style numeric folder name
# no local lockfile needed either
:0c
$WORKSPACE/
:0e # in case directory did not exist
{
:0chi
| mkdir $WORKSPACE
:0
$WORKSPACE/
}
:0chi # text is now stored in $LASTFOLDER
| perl scriptname $LASTFOLDER
:0hi
| rm -f $LASTFOLDER
}
Better yet, change the perl script to accept the text as standard input
instead of requiring it in a file. Then all you'd need is this:
:0
* conditions
| perl scriptname