procmail
[Top] [All Lists]

Re: Need your help to set Auto-respond function in procmail

2000-10-02 10:46:48
Charles, I'm sending the reply to the list also.

"KLYang" wrote:
===========================================
log file
...
procmail: Assigning "LASTFOLDER=(formail -rt -IPrecedence:junk "
From charles(_at_)localhost(_dot_)localdomain  Sun Sep 30 14:08:24 2007
 Subject: Hello
  Folder: (formail -rt -IPrecedence:junk                                  553
procmail: Notified comsat: "bobcats@:(formail -rt -IPrecedence:junk "
procmail: [2111] Sun Sep 30 14:08:25 2007
procmail: Executing "(formail,-rt,-IPrecedence:junk,"

There is something wrong with the syntax of your recipe.
If you had it as...

| (formail -rt -I"Precedence:junk" \
 -I"FROM:<charles(_at_)localhost(_dot_)localdomain>; \
 -A"X-LOOP:bobcats(_at_)localhost(_dot_)localdomain"; \
 echo "Mail received") | $SENDMAIL -t

then the above line should have said

procmail: Executing "(formail,-rt,-IPrecedence:junk \
 -I"FROM:<charles@  [[ etc ]] "

So I think there must be a space or tab after the '\' character on the 
"formail" line.  Did you edit with "vi" and say ":se list" so you
could see the end of line?  If you say "grep Precedence .procmailrc |
head -1 | od -c -t xC", do you see anything between the '\' and the
'\n' ?  Any spaces or tabs? 

================ digression: extract from my .procmailrc and logfile
Here's an example of what the log should look like for a continued
line.  First, the .procmailrc extract:

    :0 hci 
    * ... some conditions ...
    | formail -c | grep "by *$HPgateway" | \
      sed -e 's/^Received: *fr/fr/' -e "s/by *$HPgateway"'.*$//' >> bad.relays

Then, the corresponding part of logfile:

    procmail: Executing " formail -c | grep "by *$HPgateway" | \
      sed -e 's/^Received: *fr/fr/' -e "s/by *$HPgateway"'.*$//' >> bad.relays"
    procmail: Assigning "LASTFOLDER= formail -c | grep "by *$HPgateway" | \
      sed -e 's/^Received: *fr/fr/' -e "s/by *$HPgateway"'.*$//' >> bad.relays"

Notice how when it has a continuation line it shows the '\' and the
next line in the logfile?  

I'm running procmail 3.11pre7 -- what version are you running?

================ end of digression


You should delete the ';' on the line that says -I"FROM: .

Also you should put a blank after each  ':' .

(formail: (formail: No such file or directory      
^^ [[...]] What's going in on this line, when I put "(" in formail , the 
program display this error.


I think you're right about that.  Oh, I see Corey asked you to make
sure formail is really there.  I guess you've already checked for
that?  

I found a couple of recipes in my .procmailrc that say "(formail ..."
and some that say "( formail ...".  I don't think it should make a
difference if you've got a '|' or a ';' in the "line" but again, if
you have any spaces or tabs after the '\' then procmail will think
there's nothing more there and won't pass the string to the shell.

(Does that make sense?  If procmail sees a line like
      (formail SOMETHING ;  /something/else ...; /blah/blah) | xxx
 then it'll say "Oh, something from SHELLMETAS is there, I have to
 pass the whole thing to the shell" and the shell will understand that 
 "(formail" isn't the name of a program but rather tells it to spawn a 
 sub-shell.  But if procmail doesn't realize that the line contains
 ';' or '|' or something like that (e.g., if the continuation
 indicator is fouled up by having a space after it) then it'll never
 see the '|' or the ';' on a subsequent line, and it won't pass the
 thing to the shell, and will instead try to execute a program called
 "(formail" itself, passing the rest of the line as args.)

If you want to be safe, put a space between '(' and 'formail', and
another space before the closing ')'.  

Putting it all together,

| ( formail -rt -I"Precedence:junk" \
        -I"From: <charles(_at_)localhost(_dot_)localdomain> \
        -A"X-Loop: bobcats(_at_)localhost(_dot_)localdomain"; \
        echo "Mail received" ) | $SENDMAIL -t

But since something in your environment seems to make it hard to do
continuation lines, let me suggest this:

:0 
* !^FROM_DAEMON
* !^X-Loop: bobcats(_at_)localhost(_dot_)localdomain
{
    :0 hfi
    | formail -rt -A"X-Loop: bobcats(_at_)localhost(_dot_)localdomain"

    :0 hf
    | formail -I"From: <charles(_at_)localhost(_dot_)localdomain> 
-I"Precedence: junk" 

    :0 h
    | ( cat; echo Mail received ) | $SENDMAIL -t
}

As far as the $SENDMAIL value, it gets a default when procmail is
compiled.  Is the value correct?  Well, once you execute the above
you'll have an idea.

You might also try "strings `which procmail` | grep sendmail" and see 
if the result looks reasonable.

hth
-- 
Neither I nor my employer will accept any liability for any problems
or consequential loss caused by relying on this information.  Sorry.
Collin Park                         Not a statement of my employer.

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>
  • Re: Need your help to set Auto-respond function in procmail, Collin Park <=