One solution to this type of problem that I've used before
(this type of problem being "message may need more extensive
processing than is easy to do with procmail") is to write
a simple utility script somewhat along the folowing lines,
and arrange for the interesting messages to be fed to it:
####snip####
#!/bin/ksh
TMPFILE=blah.$$.${RANDOM}
trap "/bin/rm -f ${TMPFILE}; exit" EXIT HUP INT #and any other interesting
signals
# capture message
/bin/cat - >| ${TMPFILE}
# do further processing in background so procmail doesn't hang around
waiting
(
# further processing
) < /dev/null >> /dev/null 2>&1 &
####snip####
My setup is actually a bit more elaborate, but you get the idea.
It's worked quite nicely for several months now.
tw
On 01/08/1999 12:20 -0600, Todd Lindstrom wrote:
I've worked on my recurring email filter. To sum up, I get a
report via email that doesnt change very often, so I want to
store off a copy of it one day - then the next day, if the body
is the same as the previous day, I want to file it in /dev/null,
otherwise forward it to my POP account.
Here is my recipe:
:0
* ^Subject:[ ]toddltest
{
:0bc:
/home/toddl/.toddlcompare
:0B
* ? diff /home/toddl/Mail/toddltest-old /home/toddl/.toddlcompare ;
| cat > /dev/null; rsh mysun playit -v30 doorbell.au
{
:0 BC
! mypop(_at_)ti(_dot_)com
:0 b: <==== NOT WORKING HERE
/home/toddl/Mail/toddltest-old
}
}
In this test, I send a message with the subject toddltest.
The first thing I want to do is copy the body to ~/.toddlcompare
Then I want to do a diff between that file and
/home/toddl/Mail/toddltest-old
Here is the spec on the return value for diff:
DIFF(1) USER COMMANDS DIFF(1)
DIAGNOSTICS
Exit status is 0 for no differences, 1 for some differences,
2 for trouble.
So if diff returns a 0 there are no differences, so I want to send it
to /dev/null
(and for my test it plays a little sound to know it works)
If diff returns non zero, then I want it to forward to my pop account.
Then finally as a last step, I want to copy the body to toddltest-old
===========================
The problem is that the last command where it puts the body into
toddltest-old
is not executing. The log file says that it "Skipped C"
procmail: Skipped "C"
procmail: Executing "/usr/lib/sendmail,-oi,mypop(_at_)ti(_dot_)com"
procmail: Assigning "LASTFOLDER=/usr/lib/sendmail -oi
mypop(_at_)ti(_dot_)com"
How can I get that last step to work?
toddl
End of included message
--
+--------------------------------------+------------------------------------+
| Tim Walberg | Phone: (847) 632-3407 |
| Motorola CE/ITS | Pager: (800) SKY-TEL2 PIN:1384689 |
| 1475 W Shure Dr. IL75-2H14 | FAX: (847) 632-5769 |
| Arlington Heights, IL 60004 | |
+--------------------------------------+------------------------------------+
| http://www.cig.mot.com/~walberg | E-mail:
walberg(_at_)cig(_dot_)mot(_dot_)com, |
| http://www.skytel.com/Paging (pager) | 1384689(_at_)skytel(_dot_)com
(pager) |
+--------------------------------------+------------------------------------+
pgpdQMFUtKdVV.pgp
Description: PGP signature