procmail
[Top] [All Lists]

Re: Filter and Resend Message

2007-05-03 04:14:51
On Thu, May 03, 2007 at 11:09:43AM +0800, DR. Lee - NS1 wrote:

The solution, from the technical point of view, maybe clumsy but
it does what I need anyway, In business, we can not afford to
look for perfect solution.

[snip]

MY_TO=`echo ${TO}| sed -e "s/\"[^\"]*\"//" \
         -e "s/\(<\([^>]*\)>\)/\2/g" -e "s/^[    ,]*//" \
         | tr -s "       ," "\n"`

# I add this line to make sure that the  To line may have several
addresses but only yank out the one for our domain
#  in this case penit.com.

MY_TO=`echo ${MY_TO} | gawk '{i=1; while ( i <= NF) {if
(index($i,"penit.com")!=0) print $i; i=i+1;} }'`


I acknowledge your "Don't let the good be the enemy of the perfect";
in that vein, here is something easier on the eyes and, probably,
the process table:

 MY_TO = `formail -zx To: -zx Cc: | fmt -1 |
          grep @ourdomain\. | uniq -c | tr -d '[[]()<>, ]'`

(That was a tab after the comma in the final brackets.)

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>