procmail
[Top] [All Lists]

Re: formail oddity

2005-04-23 10:23:57
On Fri, Apr 22, 2005 at 08:07:00AM -0700, Bart Schaefer wrote:

On 4/22/05, Dallman Ross <dman(_at_)nomotek(_dot_)com> wrote:

On Thu, Apr 21, 2005 at 07:42:14PM -0700, Bart Schaefer wrote:

If you have any other suggestions, feel free to send them my way.
[The] practical question [is] how best to code into a shell script the
multiple options you cite above.

You don't really need to code in *all* the possibilities; you just
need to know whether the input is *empty*, not whether it's a
multi-message file, because formail works fine with the edge case of a
single-message file.

So something along the lines of
  if test -s $INPUTFILENAME
  then FORMAIL="formail -s"
  # else FORMAIL=
  fi
  $FORMAIL procmail .... < $INPUTFILENAME


'Twas a good idea, Bart.  I can see a good argument for doing that.
I was nearly persuaded.  Meanwhile, though, I've started sticking an
-I option on that formail as well, and it's a useful trick for me
(visually separating multiple message headers).  So now I've gone
to (using your naming scheme here) $INPUTFILENAME="$INPUTFILENAME:-$0}".
It's not so bad; the script is 5.xK in size.

Here's an example:

 6:54pm [~] 525[0]> vsnag.point-n-shoot.sh -v DEBUG --rc rc.ss_preload.example 
$MYVIRUS | grep H_
 procmail: Assigning "H_FROM_=wonil4(_at_)hotmail(_dot_)com  Thu Apr 21 
13:38:44 2005"
 procmail: Assigning "H_RP=wonil4(_at_)hotmail(_dot_)com"
 procmail: Assigning "H_FROM=wonil4(_at_)hotmail(_dot_)com"
 procmail: Assigning "H_TO=dman(_at_)netcom(_dot_)com"
 procmail: Assigning "H_CC="
 procmail: Assigning "H_SUBJ=HELLO"
 procmail: Assigning "H_DATE=Thu, 21 Apr 2005 13:37:21 +0200"
 procmail: Assigning 
"H_MSGID=<200504210738(_dot_)1doA0F1Rd3Nl3pX0(_at_)cave(_dot_)mail(_dot_)atl(_dot_)earthlink(_dot_)net>"
 procmail: Assigning "H_CTYPE=multipart/mixed"
 procmail: Assigning "H_XMAIL="
 procmail: Assigning "H_=:::::::::::::::::::::::::::="
 procmail: Assigning "H_FROM_=swe_kats(_at_)dell(_dot_)com  Thu Apr 21 12:31:10 
2005"
 procmail: Assigning "H_RP=swe_kats(_at_)dell(_dot_)com"
 procmail: Assigning "H_FROM=swe_kats(_at_)dell(_dot_)com"
 procmail: Assigning "H_TO=dman(_at_)netcom(_dot_)com"
 procmail: Assigning "H_CC="
 procmail: Assigning "H_SUBJ="
 procmail: Assigning "H_DATE=Thu, 21 Apr 2005 12:29:13 +0200"
 procmail: Assigning 
"H_MSGID=<200504210630(_dot_)1doyWI2Ba3Nl3oJ0(_at_)wanamaker(_dot_)mail(_dot_)atl(_dot_)earthlink(_dot_)net>"
 procmail: Assigning "H_CTYPE=multipart/mixed"
 procmail: Assigning "H_XMAIL="
 procmail: Assigning "H_=:::::::::::::::::::::::::::="
 procmail: Assigning "H_FROM_=dman(_at_)pandora(_dot_)be  Wed Apr 20 20:58:51 
2005"
 procmail: Assigning "H_RP=dman(_at_)pandora(_dot_)be"
 procmail: Assigning "H_FROM="Dman" <dman(_at_)pandora(_dot_)be>"
 procmail: Assigning "H_TO="Dman" <dman(_at_)panix(_dot_)com>"
 procmail: Assigning "H_CC="
 procmail: Assigning "H_SUBJ="
 procmail: Assigning "H_DATE=Wed, 20 Apr 2005 14:58:49 -0500"
 procmail: Assigning "H_MSGID=<cvxgtnvxyrhsskfmxkh(_at_)panix(_dot_)com>"
 procmail: Assigning "H_CTYPE=multipart/mixed"
 procmail: Assigning "H_XMAIL="
 procmail: Assigning "H_=:::::::::::::::::::::::::::="

-- 
dman

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