procmail
[Top] [All Lists]

Re: adding an Expires: header...

2006-01-04 05:02:48
On Tue, Jan 03, 2006 at 11:11:16PM -0800, Don Russell wrote:

It works fine, but my question is: is there a better way?


:0
* ^From:(_dot_)*notifier(_at_)fbo\(_dot_)gov
{
   EXPIRE = `date --utc -R --date="+7 days"`
   :0 wfc
   | formail -I "Expires: $EXPIRE"

   :0 :
   MailingLists/fbo
}

Except for what seems to me to be an extraneous c-flag on your
nested recipe, it looks okay to me at a quick glance.  (You don't
need to copy a message in order to filter it with the f-flag.)  You
could add the h-flag to the first nested recipe, since formail is
only writing to the header.

If you define EXPIRE earlier on, you could remove the
nested recipe.  The trade-off is, you'd now be using up
env space, and, worse, running date, on every single message.
Hmm.  How about:

  :0 fw h
  * ^From:(_dot_)*notifier(_at_)fbo\(_dot_)gov
  | formail -I "Expires: `date --utc -R --date='+7 days'`"

  :0 A:
  MailingLists/fbo

Well, that saves one nested recipe, but addes back
in ugliness wrt the $EXPIRE thing's disappearance,
and also eliminates the easier self-documentational
appearance of the second nested recipe rather than the
A-flag.  A nested brace-set is not expensive, so I'd
go back to something very close to what you already have.
I'd simply eliminate the c-flag and add the h-flag.
 
Dallman

____________________________________________________________
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

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