procmail
[Top] [All Lists]

Recipe setup...

1997-11-28 10:57:50
Greetings!

I am setting up a mail archiver on my system.  What I need to do is get
procmail to read in the "SUBJECT" header of any incoming mail to the
'admin' user using formail.  That subject is then written to a variable
and procmail relys on that variable to complete the recipe.  After the
variable has been assigned, procmail writes the message to a file called
the subject of all the emails: $DETAILS, then executes mhonarc with the
subject variable in it's command line.  Here is a copy of my .procmailrc:

PATH=/bin:/usr/bin:/usr/bin
MAILDIR=$HOME/mail      #you'd better make sure it exists
LOGFILE=$MAILDIR/from   #recommended
VERBOSE=yes

## IE: message comes in with subject of "BSDI: TEST"

:0 HDhc
*
## writes subject to $DETAILS variable: BSDI
| DETAILS=`formail -x Subject: | awk '{print $1}' | sed s/:/" "/`
:0 c
## finds messages with BSDI in subject and copies to ~admin/mail/BSDI
* ^Subject:$DETAILS.*
$DETAILS
:0 Ah
## Mhonarc then archives all new mail within /home/admin/mail/BSDI file,
#chmods (not proprietary to procmail), then nukes the old box BSDI so when
#mhonarc runs again, all it has to do is archive the newest message, and
#not all of them.
| mhonarc -outdir /webhome/server/htdocs/archive /home/admin/mail/$DETAIL\
; chmod 755 /webhome/server/htdocs/archive/* ; rm -rf \
/home/admin/mail/$DETAIL

It doesn't work.  I'm not sure if procmail can accept variables or not,
but anyone who can understand the above recipe, please see if their is
anything wrong with it.  BTW:  The commnets that are added into the
procmailrc were added for this email only.

Thanks in advance!

Regards,

        Jason A. Lixfeld

.oO
System Administrator [Level 4]
TUCOWS Interactive Inc. o/a Internet Direct
Moo... "A Different Kind of Internet Company"
Oo.

jlixfeld(_at_)idirect(_dot_)ca  \
                      \  jlixfeld(_at_)idirect(_dot_)com

<Prev in Thread] Current Thread [Next in Thread>