On Wed, 7 Jul 1999 19:17:52 -0400, "D. Hammond"
I've set up a couple recipes to provide pseudo-mail for one of my
children. If mail comes in with a certain tag in the Subject: line,
and the sender is found in his "white list", it gets delivered to a
file in my home directory at the ISP. I run a nightly cron job from
home that ftps the file home and appends it to his spool file. Then,
if there was any mail received for him, a message is sent to trigger
the following recipe. It's an ugly kludge, but he's not quite old
enough for free reign and this gives me some parental control.
You mean like this?
1. Mail arrives, whenever.
procmail at ISP saves to file.
2. Back home, your cron job executes.
It attempts to fetch file.
,---------------- ftp <----- cron
file ! (snatch)
`---------------> file (copy)
3. If ftp was successful, the cron job sends a command by mail
to remove the file from the ISP. (This is the part I was unsure
of. "A message is sent" from home to the ISP "to trigger [removal
of the file]" at the ISP end, yes?)
procmail <------------- nuke, please
8=X (Jolly Roger smiley :-)
4. Meanwhile, any mail that arrived while this was happening is lost
The last point can easily be remedied by renaming the file at some
point before the ftp executes, so you ftp over a datestamped copy, and
any mail which arrived between the time the spool file was renamed and
it was ftp:ed over is simply left until tomorrow (or whenever your
cron job executes next).
(So procmail would still save to "file" and if it's empty, create a
new one. Meanwhile, "file" occasionally gets renamed to "file-990708"
[for today's file] and ftp only attempts to fetch a file named this
* three conditions here that adequately identify
* any messages that trigger this recipe actually
* come from me.
* ? test -f $HOME/.../his_mbox
LOG=">>>>>>>>> $RCFILE: suitable message $NL"
| rm -f $HOME/.../his_mbox
It's probably unnecessarily anal to check for the file's existence
here, but what the hey.
(Actually, it's a complete waste of resources, because rm -f will not
complain or anything if it's not there.)
If the file exists I want to write the LOG msg, rm the file, and
bit bucket the message which triggered the process.
If the file doesn't exist, which arguably should never
happen, the incoming message should just be zapped.
* test -f $HOME/.../his_mbox # kept this for the logging
LOG=">>>>>>>>> $RCFILE: suitable message$NL"
| rm -f $HOME/.../his_mbox
# If it gets this far, the test was not true (or rm failed)
So your comments about deliveredness and extra blocks and E flags were
basically correct. (And to clone a copy to /dev/null is basically
always wrong, or at least inelegant.)
Hope this helps,
/* era */
.obBotBait: It shouldn't even matter whether <http://www.iki.fi/era/>
I am a resident of the state of Washington. <http://members.xoom.com/procmail/>
* Sign the European spam petition! <http://www.politik-digital.de/spam/en/> *