Re: send-hook to parse entry out of subject line and dump into CC field?

2001-11-19 Thread David T-G

Steven --

...and then Steven G . Harms said...
% David,
% 
% I don't know how you're getting the 'indenter' program to indent
% all your lines.  I noticed something peculiar when handling the
% mail in emacs.

I use vim as my real editor, and I simply told mutt that my editor was
the indenter program script (which then calls vim at the end of it).


% 
% So the message that mutt shows as the inline attached text
% file is /tmp/mutt-stharms-lnx-27003-79.  Here's the 'head' of
% that file:

I get that, too; my compose menu shows mutt-zero-652-2807, which
contains only the body (as far as I may have modified it by the time I
*edit* the editor), and when I'm not in an editor that's the only file in
/tmp as well.  When I am, though, I have an additional file with - as
the process number of my editor (up to 2810 as I flip to another window
and do the ls to check), and THAT file has the headers at the top of it,
as we would expect.


% 
...
% This is after having (F)iltered it thru my 'indenter' which puts a
% single ':' at the front of $_ from the STDIN file handle.

Right.  So you're filtering from the mutt compose menu, I presume.  That
sounds completely useless for what you need to do, since the headers
aren't included.


% 
% Now if I (E)dit the file i notice in emacs' buffer name line that
% the file I'm editing is:
% 
% /tmp/mutt-stharms-lnx-27003-87.

Yep.


% 
% Running 'head' on this file produces:
% 
% From: Steven G . Harms [EMAIL PROTECTED]
% To: issu [EMAIL PROTECTED]
% Cc: 
% Bcc: 
% Subject: Re: (Case #4404675) for ayazdi has been updated.
% 
% 
% Lo!  My belov'd headers are there!  It would seem that Mutt keeps the
% text+headers in one file; upon save and return to mutt it
% splits the headers OUT and treats the text section as another
% file entirely.

Yeah, it would.  That makes sense, too, since it has to create other
headers (Message-ID: leaps immediately to mind; Hi, Rob!) which are not
available via edit_headers; it will take the headers that you specify at
the front of your file and incorporate them, and then spit them out again
when you edit again.


% 
% This flies entirely in the face of what you say you were able
% to accomplish.  Does a similar effect NOT happen to you?

No, it doesn't, because I'm not trying to filter.  Forget that and write
a wrapper script which first does your indent magic (the initial version
of your Subject: and Cc: manipulation) and THEN calls your editor, with
whatever arguments you may have specified in your $editor variable, on $1
(the first arg passed to the wrapper).


% 
% I assume it's not a version difference thing.
% 
% I'm going to see if manually prepending the headers I desire can 
% get me the results I want.  I doubt it though.

Don't muck with it; change $editor and be done!


% 
% (thanks for all the perl help from the mongers BTW)

Same here!


% 
% Steven


:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg20568/pgp0.pgp
Description: PGP signature


Re: send-hook to parse entry out of subject line and dump into CC field?

2001-11-19 Thread darren chamberlain

David T-G [EMAIL PROTECTED] said something to this effect on 
11/16/2001:
 Darren  Dan --
 
 ...and then darren chamberlain said...
 % Dan Boger [EMAIL PROTECTED] said something to this effect on 11/16/2001:
 %  On Fri, Nov 16, 2001 at 01:31:30PM -0500, David T-G wrote:
 %  perl -i -n -e 's/^/-  /;' $1
 %  
 %  something like this? :)
 % 
 % Close!
 % 
 % perl -i -pe 's/^/-  /' $1
 
 Yes; thanks much to both of you.  Now throw in a matching clause that
 will trap $4 out of the subject line and print a new CC: line to it
 and he'll be done :-)

Hm.. slightly more complex, but still doable:

perl -i -ane '/^Subject:/  print Cc: $F[4]\n;print' $1

... I think (haven't tested it on a mail message, but it works on
random text files).

I don't remember the format fo the original example Subject line;
the $F[4] might need to be $F[3].

(darren)

-- 
The final delusion is that belief that one has lost all delusions. 
-- Maurice Chapelain



Re: send-hook to parse entry out of subject line and dump into CC field?

2001-11-19 Thread Steven G . Harms

In the spirit of the Open Source movement, I feel compelled
to share the solution with everyone here.

1.  To set the folder hooks for specific action when in my 'case
update' folder.

 #Issu_Updates
  folder-hook '.*Issu_Updates.*' 'set pgp_autosign=no'
  folder-hook '.*Issu_Updates.*' 'set signature=~/.issusig'
  folder-hook '.*Issu_Updates.*' 'set edit_headers=yes'
  folder-hook '.*Issu_Updates.*' 'set editor=/users/stharms/bin/issu_update_wrapper.pl'
 #/Issu_Updates

A.  Turn of PGP
B.  Get my scaled down signature with more relevant contact information
C.  Turn on Edit Headers
E.  Set editor to the wrapper.

OK, so I reply to something in this folder and it execs $editor:

Here's the script (if any perl diety wants to reduce this to an
absurdly silly one liner I'd love seeing it):

#!/usr/local/bin/perl
  $file=$ARGV[0];
  open (IN,$file);  
  open (OUT,/tmp/foo);

#Get the value of the user's id out of the input file
  while (IN){
chomp;
if (/Subject:/){
  s#.*for ##;s# has.*##;
  $userid=$_;
  close IN
}#end if
  }#end while

#replace the cc: line to cc:user
  open (IN,$file);  
  while (IN){
chomp;
if (/Cc/){
  $_ .= $userid
}
unless (/^X-/){
  unless (/^\[[TI]/){
print OUT $_\n;
  }
}
  }
  
#Move the temp outfile to the input file
  system(mv /tmp/foo $file);

#Run the most superior editor thereupon.  Skip down 8 lines so that
#I start on a starting line and not on 0 where all the header data is.
  exec (emacs -nw +8 $file );



Lastly, I had to set something so that if NOT in this folder
set it back to defaults:

 #Standard
  folder-hook !'.*Issu_Updates.*' 'set edit_headers=no'
  folder-hook !'.*Issu_Updates.*' 'set editor=/usr/bin/emacs\ -nw'
  folder-hook !'.*Issu_Updates.*' 'set pgp_autosign=yes'
 #/Standard

So that's the solve.  Any perly tips are all good.

Steven

On Tue, Nov 13, 2001 at 11:03:10AM -0800, Steven G. Harms wrote:
I have a quick question as concerns writing a send-hook to pull
out an email-address from the subject line and then dump
said address into the CC: field.

---

Background:
I use a case tool which sucks (to put it mildly)i I receive updates
from this tool in the format that the sender is the case tool
itself and the subject line contains case #xxx for USER has been updated

---

I would like to be able to reply to these messages and have the
reply go to the user.  Currently, the mail bounces back into
the daemon and is logged - but does does not get this information
to the submittor.

So if i could force CC the person AND the daemon, I could update
the case and get the mail to the person in question.  Good thinking
eh?


So i should be able to set a send hook that when replying to
case tool daemon 

But what to have it do?

Ideally it would be nice to pipe the subject line to awk, get the
fourth column (the user's email address) and then set that current
message's CC value to USERNAME.

Any ideas on how to do this?

Steven





-- 
Steven G. Harms [my opinions are my own, not my employer's]

Some mail readers may interpret this messag as having an 'attachment'
this is actually my cryptographic signature.  Protect your privacy by
using cryptography.  You can get my public encryption key at:

http://pgp.dtype.org:11371/pks/lookup?op=getsearch=0xE84048BF



Re: send-hook to parse entry out of subject line and dump into CC field?

2001-11-18 Thread Steven G . Harms

David,

I don't know how you're getting the 'indenter' program to indent
all your lines.  I noticed something peculiar when handling the
mail in emacs.

So the message that mutt shows as the inline attached text
file is /tmp/mutt-stharms-lnx-27003-79.  Here's the 'head' of
that file:

:On Fri, Nov 16, 2001 at 05:56:02PM -0800, issu wrote:
:The notes for your case #4404675 have been electronically updated byu user.. Please 
:review and handle as necessary.
:
:UPDATE:   Steven,
:

This is after having (F)iltered it thru my 'indenter' which puts a
single ':' at the front of $_ from the STDIN file handle.

Now if I (E)dit the file i notice in emacs' buffer name line that
the file I'm editing is:

/tmp/mutt-stharms-lnx-27003-87.

Running 'head' on this file produces:

From: Steven G . Harms [EMAIL PROTECTED]
To: issu [EMAIL PROTECTED]
Cc: 
Bcc: 
Subject: Re: (Case #4404675) for ayazdi has been updated.


Lo!  My belov'd headers are there!  It would seem that Mutt keeps the
text+headers in one file; upon save and return to mutt it
splits the headers OUT and treats the text section as another
file entirely.

This flies entirely in the face of what you say you were able
to accomplish.  Does a similar effect NOT happen to you?

I assume it's not a version difference thing.

I'm going to see if manually prepending the headers I desire can 
get me the results I want.  I doubt it though.

(thanks for all the perl help from the mongers BTW)

Steven



On Thu, Nov 15, 2001 at 09:40:35AM -0800, Steven G. Harms wrote:
David,

I thought I was on the right path with what you'd given me, regrettably,
I've not found a way to make this work.

When using Mutt, I Use emacs as the editor and mutt then creates an
ascii attachment from a file located in /tmp.  I realized that I could
use the 'F' option to filter this tmpfile through a perl script or
something of that nature.

Regrettably, it seems that mutt chooses NOT to touch the headers -
even when edit_headers=yes.  Here was my test.

I created 'hm.pl' which looks like:

#!/usr/local/bin/perl

while (STDIN){
  chomp;
  print --$_\n;
}

With the ultimate goal of adding something like 

if (/Subject/){$user_to_cc=s/stuff//; $_=Cc:$user_to_cc\n;print;}

So hm.pl was a preliminary test of manipulation.  

So here's a reply I passed through it:

--
To: David T-G [EMAIL PROTECTED]
Cc:
Bcc:
Subject: Re: send-hook to parse entry out of subject line and dump into CC field?
Reply-To:
In-Reply-To: [EMAIL PROTECTED]; from davidtg-muttusers@justpickon\
e.org on Wed, Nov 14, 2001 at 01:58:41PM -0500
snipped X-headers
X-Work-Focuses:  Email Server Maint.  Routing, Cisco Linux

--Let's show David T-G what it looks like thru ./hm.pl
--
--On Wed, Nov 14, 2001 at 01:58:41PM -0500, David T-G wrote:
--Steven --
--

---

As you can see, the filter operation worked ONLY on the non-header data.

Possible solutions:

1.  Find out the name of the /tmp/file (is it in a variable?) and then
execute some | command to insert the appropriate cc line into the
text.

I don't think this will work though.  If there's still the
'header' versus 'ascii attachment [i.e. content] bifurcation,
having the ability to write to that text file isn't
going to affect the headers.

2.  Find a way to access the headers themselves?

-

BUT!!! I don't understand why this is.  Even as I type this message to
you, emacs tells me your message is /tmp/mutt-stharms-lnx-20706-83.
If i run cat on that in another X-term i see:

From: Steven G. Harms [EMAIL PROTECTED]
To: David T-G [EMAIL PROTECTED]
Cc: Mutt Users' List [EMAIL PROTECTED]
Bcc: 

The header info in there plain as day.  I guess when you terminate
the editor, mutt must move the 'header' content from the editor's
temp file into the 'header' and then leave the body as the
text attachment.  This, of course, being the only thing operated
upon by the 'F' option.

Anyway, it appears I'm at an impasse.  Anyone out there have any
ideas?

Steven

On Wed, Nov 14, 2001 at 01:58:41PM -0500, David T-G wrote:
Steven --

...and then Steven G. Harms said...
% Regrettably not, i'm talking IMAP to my server..

Ah.  That makes it a little trickier.


% 
% Is it possible to to maybe pipe that to a little shell scrp that
% could parse the right field, and then pump that back INTO mutt 
% in the CC field???

At this point I'd probably ensure that edit_headers is turned on so that
you get the whole shebang and use sed (or awk) to capture the subject
line and spit out a cc: line (you can just tack that onto the headers as
an additional line; mutt will handle it) and then dive into your editor
as usual.

Hmmm...  Actually, $editor will be handed the name of an existing file,
so you might want to do this in perl where you can write back to the
file easily.


% 
% Anyone?

Have fun :-)  Post your results, too!


% 
% steven


:-D
-- 
David T-G  * It's easier to fight for one's 

Re: send-hook to parse entry out of subject line and dump into CC field?

2001-11-18 Thread Steven G . Harms

David,

I don't know how you're getting the 'indenter' program to indent
all your lines.  I noticed something peculiar when handling the
mail in emacs.

So the message that mutt shows as the inline attached text
file is /tmp/mutt-stharms-lnx-27003-79.  Here's the 'head' of
that file:

:On Fri, Nov 16, 2001 at 05:56:02PM -0800, issu wrote:
:The notes for your case #4404675 have been electronically updated byu user.. Please 
:review and handle as necessary.
:
:UPDATE:   Steven,
:

This is after having (F)iltered it thru my 'indenter' which puts a
single ':' at the front of $_ from the STDIN file handle.

Now if I (E)dit the file i notice in emacs' buffer name line that
the file I'm editing is:

/tmp/mutt-stharms-lnx-27003-87.

Running 'head' on this file produces:

From: Steven G . Harms [EMAIL PROTECTED]
To: issu [EMAIL PROTECTED]
Cc: 
Bcc: 
Subject: Re: (Case #4404675) for ayazdi has been updated.


Lo!  My belov'd headers are there!  It would seem that Mutt keeps the
text+headers in one file; upon save and return to mutt it
splits the headers OUT and treats the text section as another
file entirely.

This flies entirely in the face of what you say you were able
to accomplish.  Does a similar effect NOT happen to you?

I assume it's not a version difference thing.

I'm going to see if manually prepending the headers I desire can 
get me the results I want.  I doubt it though.

(thanks for all the perl help from the mongers BTW)

Steven



On Thu, Nov 15, 2001 at 09:40:35AM -0800, Steven G. Harms wrote:
David,

I thought I was on the right path with what you'd given me, regrettably,
I've not found a way to make this work.

When using Mutt, I Use emacs as the editor and mutt then creates an
ascii attachment from a file located in /tmp.  I realized that I could
use the 'F' option to filter this tmpfile through a perl script or
something of that nature.

Regrettably, it seems that mutt chooses NOT to touch the headers -
even when edit_headers=yes.  Here was my test.

I created 'hm.pl' which looks like:

#!/usr/local/bin/perl

while (STDIN){
  chomp;
  print --$_\n;
}

With the ultimate goal of adding something like 

if (/Subject/){$user_to_cc=s/stuff//; $_=Cc:$user_to_cc\n;print;}

So hm.pl was a preliminary test of manipulation.  

So here's a reply I passed through it:

--
To: David T-G [EMAIL PROTECTED]
Cc:
Bcc:
Subject: Re: send-hook to parse entry out of subject line and dump into CC field?
Reply-To:
In-Reply-To: [EMAIL PROTECTED]; from davidtg-muttusers@justpickon\
e.org on Wed, Nov 14, 2001 at 01:58:41PM -0500
snipped X-headers
X-Work-Focuses:  Email Server Maint.  Routing, Cisco Linux

--Let's show David T-G what it looks like thru ./hm.pl
--
--On Wed, Nov 14, 2001 at 01:58:41PM -0500, David T-G wrote:
--Steven --
--

---

As you can see, the filter operation worked ONLY on the non-header data.

Possible solutions:

1.  Find out the name of the /tmp/file (is it in a variable?) and then
execute some | command to insert the appropriate cc line into the
text.

I don't think this will work though.  If there's still the
'header' versus 'ascii attachment [i.e. content] bifurcation,
having the ability to write to that text file isn't
going to affect the headers.

2.  Find a way to access the headers themselves?

-

BUT!!! I don't understand why this is.  Even as I type this message to
you, emacs tells me your message is /tmp/mutt-stharms-lnx-20706-83.
If i run cat on that in another X-term i see:

From: Steven G. Harms [EMAIL PROTECTED]
To: David T-G [EMAIL PROTECTED]
Cc: Mutt Users' List [EMAIL PROTECTED]
Bcc: 

The header info in there plain as day.  I guess when you terminate
the editor, mutt must move the 'header' content from the editor's
temp file into the 'header' and then leave the body as the
text attachment.  This, of course, being the only thing operated
upon by the 'F' option.

Anyway, it appears I'm at an impasse.  Anyone out there have any
ideas?

Steven

On Wed, Nov 14, 2001 at 01:58:41PM -0500, David T-G wrote:
Steven --

...and then Steven G. Harms said...
% Regrettably not, i'm talking IMAP to my server..

Ah.  That makes it a little trickier.


% 
% Is it possible to to maybe pipe that to a little shell scrp that
% could parse the right field, and then pump that back INTO mutt 
% in the CC field???

At this point I'd probably ensure that edit_headers is turned on so that
you get the whole shebang and use sed (or awk) to capture the subject
line and spit out a cc: line (you can just tack that onto the headers as
an additional line; mutt will handle it) and then dive into your editor
as usual.

Hmmm...  Actually, $editor will be handed the name of an existing file,
so you might want to do this in perl where you can write back to the
file easily.


% 
% Anyone?

Have fun :-)  Post your results, too!


% 
% steven


:-D
-- 
David T-G  * It's easier to fight for one's 

Re: send-hook to parse entry out of subject line and dump into CC field?

2001-11-16 Thread David T-G

Steven --

...and then Steven G. Harms said...
% David,
% 
% I thought I was on the right path with what you'd given me, regrettably,
% I've not found a way to make this work.

Well, we're getting close.


% 
% When using Mutt, I Use emacs as the editor and mutt then creates an

No flames today :-)


% ascii attachment from a file located in /tmp.  I realized that I could
% use the 'F' option to filter this tmpfile through a perl script or


% something of that nature.

Hmmm...  Rather than that, just modify the file before you open the
editor on it.


% 
% Regrettably, it seems that mutt chooses NOT to touch the headers -
% even when edit_headers=yes.  Here was my test.
% 
% I created 'hm.pl' which looks like:

I created /tmp/ed.sh which looks like

  #!/bin/sh
  
  perl -e '
open MUTTI,  '$1';
open MUTTO, '$1'.out;
while(MUTTI)
  {
print(-); ###
print(MUTTO   $_);
  }
  print(\n);  ###
close MUTTI;
close MUTTO;
'
  mv -f $1.out $1
  
  vim +/^$ $*

and set my $editor to that (note the clever unquoting of $1 in the open
lines) and, sure enough, found my entire file indented by two lines.

I let mutt put together the headers and the body and then hand it to the
editor, which I've specified as a wrapper which will first manipulate
the file it's handed.

Now, I know that there is a way to edit in place in perl and skip the
temp file, but it doesn't pop to mind.  I could do it easily in ed but
that would probably be tough to use to grab the Subject: line and
generate a Cc: line :-)


...
% As you can see, the filter operation worked ONLY on the non-header data.
% 
% Possible solutions:
% 
% 1.  Find out the name of the /tmp/file (is it in a variable?) and then
% execute some | command to insert the appropriate cc line into the
% text.

The /tmp/file is passed to the $editor command, so you can easily read it
from your wrapper.


% 
% I don't think this will work though.  If there's still the
% 'header' versus 'ascii attachment [i.e. content] bifurcation,
% having the ability to write to that text file isn't
% going to affect the headers.

I don't think that will be any problem.


% 
% 2.  Find a way to access the headers themselves?

Nah; don't bother.


% 
% -
% 
% BUT!!! I don't understand why this is.  Even as I type this message to
% you, emacs tells me your message is /tmp/mutt-stharms-lnx-20706-83.
% If i run cat on that in another X-term i see:

Yep; by the time your editor gets it it's been put together.


HTH  HAND

:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg20509/pgp0.pgp
Description: PGP signature


Re: send-hook to parse entry out of subject line and dump into CC field?

2001-11-16 Thread David T-G

Steven --

...and then Steven G. Harms said...
% David,
% 
% I thought I was on the right path with what you'd given me, regrettably,
% I've not found a way to make this work.

Well, we're getting close.


% 
% When using Mutt, I Use emacs as the editor and mutt then creates an

No flames today :-)


% ascii attachment from a file located in /tmp.  I realized that I could
% use the 'F' option to filter this tmpfile through a perl script or


% something of that nature.

Hmmm...  Rather than that, just modify the file before you open the
editor on it.


% 
% Regrettably, it seems that mutt chooses NOT to touch the headers -
% even when edit_headers=yes.  Here was my test.
% 
% I created 'hm.pl' which looks like:

I created /tmp/ed.sh which looks like

  #!/bin/sh
  
  perl -e '
open MUTTI,  '$1';
open MUTTO, '$1'.out;
while(MUTTI)
  {
print(-); ###
print(MUTTO   $_);
  }
  print(\n);  ###
close MUTTI;
close MUTTO;
'
  mv -f $1.out $1
  
  vim +/^$ $*

and set my $editor to that (note the clever unquoting of $1 in the open
lines) and, sure enough, found my entire file indented by two lines.

I let mutt put together the headers and the body and then hand it to the
editor, which I've specified as a wrapper which will first manipulate
the file it's handed.

Now, I know that there is a way to edit in place in perl and skip the
temp file, but it doesn't pop to mind.  I could do it easily in ed but
that would probably be tough to use to grab the Subject: line and
generate a Cc: line :-)


...
% As you can see, the filter operation worked ONLY on the non-header data.
% 
% Possible solutions:
% 
% 1.  Find out the name of the /tmp/file (is it in a variable?) and then
% execute some | command to insert the appropriate cc line into the
% text.

The /tmp/file is passed to the $editor command, so you can easily read it
from your wrapper.


% 
% I don't think this will work though.  If there's still the
% 'header' versus 'ascii attachment [i.e. content] bifurcation,
% having the ability to write to that text file isn't
% going to affect the headers.

I don't think that will be any problem.


% 
% 2.  Find a way to access the headers themselves?

Nah; don't bother.


% 
% -
% 
% BUT!!! I don't understand why this is.  Even as I type this message to
% you, emacs tells me your message is /tmp/mutt-stharms-lnx-20706-83.
% If i run cat on that in another X-term i see:

Yep; by the time your editor gets it it's been put together.


HTH  HAND

:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg20510/pgp0.pgp
Description: PGP signature


Re: send-hook to parse entry out of subject line and dump into CC field?

2001-11-16 Thread Dan Boger

On Fri, Nov 16, 2001 at 01:31:30PM -0500, David T-G wrote:
 I created /tmp/ed.sh which looks like
 
   #!/bin/sh
   
   perl -e '
 open MUTTI,  '$1';
 open MUTTO, '$1'.out;
 while(MUTTI)
   {
 print(-);   ###
 print(MUTTO   $_);
   }
   print(\n);###
 close MUTTI;
 close MUTTO;
 '
   mv -f $1.out $1
   
   vim +/^$ $*
 
 and set my $editor to that (note the clever unquoting of $1 in the open
 lines) and, sure enough, found my entire file indented by two lines.
 
 I let mutt put together the headers and the body and then hand it to the
 editor, which I've specified as a wrapper which will first manipulate
 the file it's handed.
 
 Now, I know that there is a way to edit in place in perl and skip the
 temp file, but it doesn't pop to mind.  I could do it easily in ed but
 that would probably be tough to use to grab the Subject: line and
 generate a Cc: line :-)

perl -i -n -e 's/^/-  /;' $1

something like this? :)


-- 
Dan Boger
Linux MVP
brainbench.com




msg20511/pgp0.pgp
Description: PGP signature


Re: send-hook to parse entry out of subject line and dump into CC field?

2001-11-16 Thread darren chamberlain

Dan Boger [EMAIL PROTECTED] said something to this effect on 11/16/2001:
 On Fri, Nov 16, 2001 at 01:31:30PM -0500, David T-G wrote:
 perl -i -n -e 's/^/-  /;' $1
 
 something like this? :)

Close!

perl -i -pe 's/^/-  /' $1

(darren)

-- 
We are Pentium of Borg. Division is futile. You will be approximated.



Re: send-hook to parse entry out of subject line and dump into CC field?

2001-11-16 Thread Dan Boger

On Fri, Nov 16, 2001 at 01:50:05PM -0500, darren chamberlain wrote:
 Dan Boger [EMAIL PROTECTED] said something to this effect on 11/16/2001:
  On Fri, Nov 16, 2001 at 01:31:30PM -0500, David T-G wrote:
  perl -i -n -e 's/^/-  /;' $1
  
  something like this? :)
 
 Close!
 
 perl -i -pe 's/^/-  /' $1

doh!  what was I thinking!  

-- 
Dan Boger
[EMAIL PROTECTED]



msg20513/pgp0.pgp
Description: PGP signature


Re: send-hook to parse entry out of subject line and dump into CC field?

2001-11-16 Thread David T-G

Darren  Dan --

...and then darren chamberlain said...
% Dan Boger [EMAIL PROTECTED] said something to this effect on 11/16/2001:
%  On Fri, Nov 16, 2001 at 01:31:30PM -0500, David T-G wrote:
%  perl -i -n -e 's/^/-  /;' $1
%  
%  something like this? :)
% 
% Close!
% 
% perl -i -pe 's/^/-  /' $1

Yes; thanks much to both of you.  Now throw in a matching clause that
will trap $4 out of the subject line and print a new CC: line to it
and he'll be done :-)


% 
% (darren)
% 
% -- 
% We are Pentium of Borg. Division is futile. You will be approximated.


:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg20514/pgp0.pgp
Description: PGP signature


Re: send-hook to parse entry out of subject line and dump into CC field?

2001-11-15 Thread Steven G. Harms

David,

I thought I was on the right path with what you'd given me, regrettably,
I've not found a way to make this work.

When using Mutt, I Use emacs as the editor and mutt then creates an
ascii attachment from a file located in /tmp.  I realized that I could
use the 'F' option to filter this tmpfile through a perl script or
something of that nature.

Regrettably, it seems that mutt chooses NOT to touch the headers -
even when edit_headers=yes.  Here was my test.

I created 'hm.pl' which looks like:

#!/usr/local/bin/perl

while (STDIN){
  chomp;
  print --$_\n;
}

With the ultimate goal of adding something like 

if (/Subject/){$user_to_cc=s/stuff//; $_=Cc:$user_to_cc\n;print;}

So hm.pl was a preliminary test of manipulation.  

So here's a reply I passed through it:

--
To: David T-G [EMAIL PROTECTED]
Cc:
Bcc:
Subject: Re: send-hook to parse entry out of subject line and dump into CC field?
Reply-To:
In-Reply-To: [EMAIL PROTECTED]; from davidtg-muttusers@justpickon\
e.org on Wed, Nov 14, 2001 at 01:58:41PM -0500
snipped X-headers
X-Work-Focuses:  Email Server Maint.  Routing, Cisco Linux

--Let's show David T-G what it looks like thru ./hm.pl
--
--On Wed, Nov 14, 2001 at 01:58:41PM -0500, David T-G wrote:
--Steven --
--

---

As you can see, the filter operation worked ONLY on the non-header data.

Possible solutions:

1.  Find out the name of the /tmp/file (is it in a variable?) and then
execute some | command to insert the appropriate cc line into the
text.

I don't think this will work though.  If there's still the
'header' versus 'ascii attachment [i.e. content] bifurcation,
having the ability to write to that text file isn't
going to affect the headers.

2.  Find a way to access the headers themselves?

-

BUT!!! I don't understand why this is.  Even as I type this message to
you, emacs tells me your message is /tmp/mutt-stharms-lnx-20706-83.
If i run cat on that in another X-term i see:

From: Steven G. Harms [EMAIL PROTECTED]
To: David T-G [EMAIL PROTECTED]
Cc: Mutt Users' List [EMAIL PROTECTED]
Bcc: 

The header info in there plain as day.  I guess when you terminate
the editor, mutt must move the 'header' content from the editor's
temp file into the 'header' and then leave the body as the
text attachment.  This, of course, being the only thing operated
upon by the 'F' option.

Anyway, it appears I'm at an impasse.  Anyone out there have any
ideas?

Steven

On Wed, Nov 14, 2001 at 01:58:41PM -0500, David T-G wrote:
Steven --

...and then Steven G. Harms said...
% Regrettably not, i'm talking IMAP to my server..

Ah.  That makes it a little trickier.


% 
% Is it possible to to maybe pipe that to a little shell scrp that
% could parse the right field, and then pump that back INTO mutt 
% in the CC field???

At this point I'd probably ensure that edit_headers is turned on so that
you get the whole shebang and use sed (or awk) to capture the subject
line and spit out a cc: line (you can just tack that onto the headers as
an additional line; mutt will handle it) and then dive into your editor
as usual.

Hmmm...  Actually, $editor will be handed the name of an existing file,
so you might want to do this in perl where you can write back to the
file easily.


% 
% Anyone?

Have fun :-)  Post your results, too!


% 
% steven


:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




-- 
[The first attachment to this email is a cryptographic signature.
I protect my privacy by using GnuPG for Linux]

 || ||  Steven G. Harms 
:||:   :||: [EMAIL PROTECTED]
   ::||:: ::||::[EMAIL PROTECTED]
 .:::||:::. .:::||:::.  (408)525-1767 
...::||::. . . . ..:||::... 
[[Cisco Systems:  Empowering the Internet Generation]]




msg20476/pgp0.pgp
Description: PGP signature


Re: send-hook to parse entry out of subject line and dump into CC field?

2001-11-14 Thread Steven G. Harms

Regrettably not, i'm talking IMAP to my server..

Is it possible to to maybe pipe that to a little shell scrp that
could parse the right field, and then pump that back INTO mutt 
in the CC field???

Anyone?

steven


On Tue, Nov 13, 2001 at 02:02:26PM -0500, darren chamberlain wrote:
Steven G. Harms [EMAIL PROTECTED] said something to this effect on 11/13/2001:

  *snip*

 I would like to be able to reply to these messages and have the
 reply go to the user.  Currently, the mail bounces back into
 the daemon and is logged - but does does not get this information
 to the submittor.

  *snip*

If you are using procmail to filter your mail, perhaps you could
have procmail look for this header and rewrite the Reply-To:
header so that it points to the address in the subject.

(darren)

-- 
What if everything is an illusion and nothing exists? In that case, I
definitely overpaid for my carpet.
-- Woody Allen

-- 
[The first attachment to this email is a cryptographic signature.
I protect my privacy by using GnuPG for Linux]

 || ||  Steven G. Harms 
:||:   :||: [EMAIL PROTECTED]
   ::||:: ::||::[EMAIL PROTECTED]
 .:::||:::. .:::||:::.  (408)525-1767 
...::||::. . . . ..:||::... 
[[Cisco Systems:  Empowering the Internet Generation]]




msg20429/pgp0.pgp
Description: PGP signature


Re: send-hook to parse entry out of subject line and dump into CC field?

2001-11-14 Thread David T-G

Steven --

...and then Steven G. Harms said...
% Regrettably not, i'm talking IMAP to my server..

Ah.  That makes it a little trickier.


% 
% Is it possible to to maybe pipe that to a little shell scrp that
% could parse the right field, and then pump that back INTO mutt 
% in the CC field???

At this point I'd probably ensure that edit_headers is turned on so that
you get the whole shebang and use sed (or awk) to capture the subject
line and spit out a cc: line (you can just tack that onto the headers as
an additional line; mutt will handle it) and then dive into your editor
as usual.

Hmmm...  Actually, $editor will be handed the name of an existing file,
so you might want to do this in perl where you can write back to the
file easily.


% 
% Anyone?

Have fun :-)  Post your results, too!


% 
% steven


:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg20431/pgp0.pgp
Description: PGP signature


send-hook to parse entry out of subject line and dump into CC field?

2001-11-13 Thread Steven G. Harms

I have a quick question as concerns writing a send-hook to pull
out an email-address from the subject line and then dump
said address into the CC: field.

---

Background:
I use a case tool which sucks (to put it mildly)i I receive updates
from this tool in the format that the sender is the case tool
itself and the subject line contains case #xxx for USER has been updated

---

I would like to be able to reply to these messages and have the
reply go to the user.  Currently, the mail bounces back into
the daemon and is logged - but does does not get this information
to the submittor.

So if i could force CC the person AND the daemon, I could update
the case and get the mail to the person in question.  Good thinking
eh?


So i should be able to set a send hook that when replying to
case tool daemon 

But what to have it do?

Ideally it would be nice to pipe the subject line to awk, get the
fourth column (the user's email address) and then set that current
message's CC value to USERNAME.

Any ideas on how to do this?

Steven





msg20401/pgp0.pgp
Description: PGP signature


Re: send-hook to parse entry out of subject line and dump into CC field?

2001-11-13 Thread darren chamberlain

Steven G. Harms [EMAIL PROTECTED] said something to this effect on 11/13/2001:

  *snip*

 I would like to be able to reply to these messages and have the
 reply go to the user.  Currently, the mail bounces back into
 the daemon and is logged - but does does not get this information
 to the submittor.

  *snip*

If you are using procmail to filter your mail, perhaps you could
have procmail look for this header and rewrite the Reply-To:
header so that it points to the address in the subject.

(darren)

-- 
What if everything is an illusion and nothing exists? In that case, I
definitely overpaid for my carpet.
-- Woody Allen