First, create a new user account to handle these messages.
In the user's home directory, add this to .forward, replacing the UserName with the actual username:
"|/etc/smrsh/mailcmd || exit 75 #UserName"
Run this snippet of code:
cat > /usr/local/sbin/mailcmd <<\EoT
if echo "$Message" | grep "..." > /dev/null; then
echo "$Message" | formail -I "" > /tmp/mailcmd
chmod 755 /usr/local/sbin/mailcmd
ln -s /usr/local/sbin/mailcmd /etc/smrsh
Next, test that email sent to this user actually creates a file in /tmp. When you have that
working, the next step is to replace the ... with a string to find valid messages. Test to
make sure valid messages create files in /tmp, but other messages do not. Then you can replace
the file creation command with the command you actually want to run.