At 20:23 2005-06-06 +0200, Dallman Ross wrote:
[snip]
You could do that easily with formail. However, unless I'm missing
something or something is unsaid in your explanation, you don't need
to do that. Just save the message like so:
:0:
* conditions
| cat > file
Presuming of course that he's putting each report in a separate file, and
that he's reading the mail on the unix server (or using IMAP mailboxes),
rather than trying to download via POP from a single mailbox. Certainly,
this approach is the easiest. One could integrate it into a POP-based
solution by storing the reports in this fashion, and then having a script
that appends the contents of the report(s) to the system mailbox upon
receipt of a "issue reports" type message (which might also then purge the
current list of report files). basically - you don't store them to the
system mailbox until the user is ready to download them.
In the case of trying to manage the reports from within the system mailbox,
on receiving the report, you'd reprocess the mailbox with a script, then
append your new message. Reprocessing the entire mailbox file though could
be painful if there are a lot of messages in it or if you get a lot of
reports, or if you check email frequently (which is why it is imperative
that your POP locking strategy is compatible with whatever you're doing for
a rewrite script).
Something like (the following is NOT refined or useable AS-IS):
:0
* some_criteria_identifying_the_report
{
RESULT=|some_script
:0:
$DEFAULT
}
the script would be something like:
formail -s procmail -m purge_report.sh < /path/to/your/mailbox
where purge_report.sh has a rule that discards a message matching the
identifying criteria of the report. You'll need to either move the mailbox
BEFORE running procmail in the script (and have procmail output to the
mailbox in it's usual place), or have procmail output to a temporary
mailbox file and then replace the system mailbox with it when it is
done. check 'man lockfile', which is a component of procmail specifically
set up so that you can manupulate procmail-compatible lockfile strategies
from shell scripts.
There's a modular way to use the _SAME_ recipe for the outer and inner
calls (i.e. the live AND reprocess rules), but explaining it would be a bit
tedious for me right now, and I've got other things I need to be
doing. It'd be beneficial if you had quite a few different types of
reports to do this with, but isn't worth the effort if you've got only one
or two.
---
Sean B. Straw / Professional Software Engineering
Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
Please DO NOT carbon me on list replies. I'll get my copy from the list.
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail