List Info

Thread: procmail/formail syntax question




procmail/formail syntax question
user name
2005-10-23 23:25:30
Please do *not* remove the mailing list from the Cc: header,
unless
there is a very good reason (i.e. confidential information
in the
message text).

On 2005-10-23 19:11, stan <stanbpanix.com> wrote:
>On Mon, Oct 24, 2005 at 01:13:18AM +0300, Giorgos
Keramidas wrote:
>>On 2005-10-23 17:49, stan <stanbpanix.com> wrote:
>>>On Sun, Oct 23, 2005 at 10:07:17PM +0200,
Rolannessto wrote:
>>>>On Sun, Oct 23, 2005 at 03:09:51PM -0400,
stan wrote:
>>>>> I'm trying to get procmail to rewrite
the TO: header. I've tried something like:
>>>>>
>>>>> TO=`formail -xTo:`
>>
>> 	:0 Hf
>> 	* X-Virus-Status: Yes
>> 	| sed -e 's/^[sS]ubject:[[:space:]]+/Subject:
[virus] '
>
> Mmm, we are close here I put in:
>
> # test
> :0 Hf
> | sed -e 's/^[tT]o:[[:space:]]+/To: [STAN] '
>
> (Unconditional to test the action).

That's plainly wrong.  The "To:" header will
contain broken crap instead
of a recipient address.  Just *DON'T* do that.  Try to
modify the
"Subject:" instead.  I'm positively sure than even
the crapware from a
well-known Redmond-based company can filter based on the
subject of
individual posts.

> But I got this error in the procmail logfile:
>
> sed: 1: "s/^[tT]o:[[:space:]]+/ ...":
unescaped newline inside substitute pattern

It may be that procmail does weird things with the regexp
string or that
procmail doesn't accept extended regexps (I think I remember
finding out
about this one a while ago).  Let's see:

% flame:/home/keramida$ cd /tmp/stan/
% flame:/tmp/stan$ ls -l
% total 6
% -rw-------  1 keramida  wheel  - 4109 Oct 24 02:13 mbox
% flame:/tmp/stan$ cat > procmailrc
% :0 Hf
% | sed -e 's/^[tT]o:[[:space:]]+/To: [STAN] '
% flame:/tmp/stan$ formail -s procmail /tmp/stan/procmailrc
< mbox | grep -i to:
% sed: 1: "s/^[tT]o:[[:space:]]+/ ...": unescaped
newline inside substitute pattern
% flame:/tmp/stan$

When I avoid using the + trick, it works fine:

% flame:/tmp/stan$ cat > procmailrc
% :0 Hf
% | sed -e
's/^[tT][oO]:[[:space:]][[:space:]]*([^[:space:]])/To:
[STAN] 1/'
%
% :0
% /tmp/stan/newbox
% flame:/tmp/stan$ formail -s procmail /tmp/stan/procmailrc
< mbox
% flame:/tmp/stan$ ls -l
% total 14
% -rw-------  1 keramida  wheel  - 4109 Oct 24 02:13 mbox
% -rw-------  1 keramida  wheel  - 4116 Oct 24 02:20 newbox
% -rw-rw-r--  1 keramida  wheel  -  105 Oct 24 02:19
procmailrc
% flame:/tmp/stan$ diff -u mbox newbox
% --- mbox        Mon Oct 24 02:13:03 2005
% +++ newbox      Mon Oct 24 02:20:05 2005
%  -36,7 +36,7 
%         for <keramidaceid.upatras.gr>; Sun,
23 Oct 2005 19:11:03 -0400
%  Date: Sun, 23 Oct 2005 19:11:03 -0400
%  From: stan <stanbpanix.com>
% -To: Giorgos Keramidas <keramidaceid.upatras.gr>
% +To: [STAN] Giorgos Keramidas <keramidaceid.upatras.gr>
%  Subject: Re: procmail/formail syntax question
%  Message-ID: <20051023231103.GE31109teddy.fas.com>
%  References: <20051023190951.GA25702teddy.fas.com> <20051023200717.GB82057slackbox.xs4all.nl> <20051023214939.GB30009teddy.fas.com> <20051023221317.GA1211flame.pc>

So it *does* work, using plain regexps and not extended
regexps and it
changes the To: header as expected (even though that's
wrong, as I said
above).

- Giorgos

_______________________________________________
freebsd-questionsfreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-que
stions
To unsubscribe, send any mail to
"freebsd-questions-unsubscribefreebsd.org"
procmail/formail syntax question
user name
2005-10-23 23:53:25
On Mon, Oct 24, 2005 at 02:25:30AM +0300, Giorgos Keramidas
wrote:
> Please do *not* remove the mailing list from the Cc:
header, unless
> there is a very good reason (i.e. confidential
information in the
> message text).
> 

Sorry, I hit "r" instead of "l" in mutt.

My apoligies.

-- 
U.S. Encouraged by Vietnam Vote - Officials Cite 83% Turnout
Despite Vietcong Terror 
- New York Times 9/3/1967
_______________________________________________
freebsd-questionsfreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-que
stions
To unsubscribe, send any mail to
"freebsd-questions-unsubscribefreebsd.org"
procmail/formail syntax question
user name
2005-10-24 01:28:49
On 2005-10-23 19:53, stan <stanbpanix.com> wrote:
>On Mon, Oct 24, 2005 at 02:25:30AM +0300, Giorgos
Keramidas wrote:
>> Please do *not* remove the mailing list from the
Cc: header, unless
>> there is a very good reason (i.e. confidential
information in the
>> message text).
>
> Sorry, I hit "r" instead of "l" in
mutt.
> My apoligies.

That's ok.  I usually hit 'g' (group-reply), and it's not
too much
trouble to Cc: the list again.

_______________________________________________
freebsd-questionsfreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-que
stions
To unsubscribe, send any mail to
"freebsd-questions-unsubscribefreebsd.org"
procmail/formail syntax question
user name
2005-10-24 02:22:48
On Mon, Oct 24, 2005 at 04:28:49AM +0300, Giorgos Keramidas
wrote:
> On 2005-10-23 19:53, stan <stanbpanix.com> wrote:
> >On Mon, Oct 24, 2005 at 02:25:30AM +0300, Giorgos
Keramidas wrote:
> >> Please do *not* remove the mailing list from
the Cc: header, unless
> >> there is a very good reason (i.e. confidential
information in the
> >> message text).
> >
> > Sorry, I hit "r" instead of
"l" in mutt.
> > My apoligies.
> 
> That's ok.  I usually hit 'g' (group-reply), and it's
not too much
> trouble to Cc: the list again.

<hits "g">

Oh, and I learned another mutt command!

Another secret mutt user surfaces 

-- 
U.S. Encouraged by Vietnam Vote - Officials Cite 83% Turnout
Despite Vietcong Terror 
- New York Times 9/3/1967
_______________________________________________
freebsd-questionsfreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-que
stions
To unsubscribe, send any mail to
"freebsd-questions-unsubscribefreebsd.org"
[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )