procmail
[Top] [All Lists]

Re: passing arguments as parameters to a script

2002-02-04 10:15:45
On Mon, 4 Feb 2002, Tom Van de Wiele wrote:

Does procmail have any way of generating errors?  Sometimes the severe
errors end up in my sendmail logs, but for stuff like this, I get
nothing.

The best way to diagnose procmail errors is to have it logging in verbose
mode.  You've almost got that configured:

SENDMAIL=/usr/sbin/sendmail
LOGFILE=$HOME=/.maillog
VERBOSE=yes

Except for the typo in your assignment to LOGFILE.

I think you mean:

  LOGFILE=$HOME/.maillog

Fix that, and you should see copious information in $HOME/.maillog to help
you diagnose procmail problems.

SUBJECT=`formail -zxSubject:`

:0 h c
* ^TO(_dot_)*unsubscribe(_at_)domain(_dot_)com
{
   :0 h c
   | mkdir $SUBJECT
}

I see a few problems here:

(1) The 'h' flag means 'Feed the header to the pipe, file or mail
  destination'.  This has no meaning when used on a nested block
  (a {...} construct), since you're not piping the message to anything.

(2) You've got the 'c' flag twice.  You should probably pay close attention
  to the following section of the procmailrc man page:

       c    Generate a carbon copy of this mail.  This only makes
            sense on delivering recipes.  The only non-delivering
            recipe  this  flag  has  an effect on is on a nesting
            block, in order to generate a carbon copy  this  will
            clone  the  running  procmail process (lockfiles will
            not be inherited), whereby the clone will proceed  as
            usual and the parent will jump across the block.

  If you really want a copy of the message to be filtered by later
  recipes (or delivered to your default mailbox), remove the 'c'
  flag from the beginning of the nested block.

(3) Since 'mkdir' isn't actually doing anything with the message contents,
  there's a good chance that it will exit before procmail finishes
  writing the message header to its stdin.  This will generate an error.

  Take another look at the procmailrc man page, this time at the
  documentation for the 'i' flag:

       i    Ignore any write errors on this recipe (i.e., usually
            due to an early closed pipe).

Hope this helps,

-- Lars

-- 
Lars Kellogg-Stedman <lars(_at_)larsshack(_dot_)org>

_______________________________________________
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>