procmail
[Top] [All Lists]

Re: Recipe setup...

1997-11-29 02:13:44
Thanks Dave!

I've tried it, and it didn't work! :)  Although from what I can see in my
'from' file, it managed to assign SUB=<SUBJECT>.  Have a look: 

.procmailrc:

:0 D
*
{
SUB=`formail -x Subject: | awk '{print $1}' | sed s/:/""/`
}
:0 c
* ^Subject:.*\<$SUB\>
/home/admin/mail/$SUB 

from:

procmail: [11894] Sat Nov 29 04:03:02 1997
procmail: Match on ""
procmail: Executing "formail -x Subject: | awk '{print $1}' | sed s/:/""/"
procmail: Assigning "SUB=BSDI"

^^^^^^^^^^

Everything above is okay, but all of the below is still broken:

procmail: No match on "^Subject:.*\<$SUB }"
procmail: Locking "/var/spool/mail/admin.lock"
procmail: Error while writing to "/var/spool/mail/_rv2Gsuntzu.ad"

The above, broken part is where I try to save the message to the file
called the variable which was created above (procmail: Assigning
"SUB=BSDI").  Technically, I should be able to assign the directory
by some method similar to what is written in the :0 c portion of the
recipe.

Anyone know how I can do that?!  Does everyone see what I'm trying to do?

On Fri, 28 Nov 1997, no-mailbox wrote:

On Fri, 28 Nov 1997, Jason Lixfeld wrote:

Jason,
I think the problem is the first recipe. You cant set  avariable in an
action line like you did because it gets executed in a subshell. You
have to use curly-braces and drop the flags. Your first recipe
modified:

## IE: message comes in with subject of "BSDI: TEST" >
## writes subject to $DETAILS variable: BSDI
:0 D
*
{  DETAILS=`formail -x Subject: | awk '{print $1}' | sed s/:/" "/`  }

I dont' know awk and sed well, but it seems to simply reduce the
subject line to the first word, minus the colon. You could use this: 
:0 D
* ^Subject:[   ]*BSDI: TEST
{  DETAILS=BSDI }

Of course, that only demonstrates the job. You'd have to customize for
your needs. There are other ways to do this, but I'd have to
understand the needs better.

The next recipe copies to a file named BSDI. You need to use a fulll
path, and procmail does not recognize tilde. I'm guessing ~admin is a
typo for ~/admin so then the recipe is:
## finds messages with BSDI in subject and copies to ~admin/mail/BSDI
:0 c
* ^Subject:.*\<$DETAILS\>
$HOME/admin/mail/$DETAILS

Good Luck!
David Hunt

: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





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>