chris@hpgnd.HP.COM (Christian LOTITO) (11/28/89)
Hello, i'd like the cmd 'forw' to fill the subject field automatically with the subject of the message to be forwarded. Is there any way to achieve that ? Thanks in advance, Chris Lotito / Hewlett-Packard - GND Lab
marvit@hplpm.hpl.hp.com (Peter Marvit) (11/29/89)
> i'd like the cmd 'forw' to fill the subject field automatically > with the subject of the message to be forwarded. > > Is there any way to achieve that ? [[ The short answer, you can't since forw is non-programtic. However, here is a kluge I put together a while ago for some collegues. If you need a lengthy explanation of why, e-mail me. On the other hand, forw'ding from mh-e within GnuEmacs does this right thing, since Gnu does extra processing! -PM ]] Ok fans, here's the Mail Heretic's prescription for getting "forw" to include the original header. 1. Cut at the dotted lines the chuck of code at the end of this message and unpack the following file in your ~/Mail directory. Edit forw-test.form to include your own "From" field, or delete that line entirely. 2. As root, mv /usr/local/bin/mh/forw /usr/local/bin/mh/forw.orig ln /usr/local/bin/mh/repl /usr/local/bin/mh/forw Note that you must call the original forw by its new name if you use it. 3. Edit the "forw" entry in your ~/.mh_profile so it looks something like this: forw: forw-test.form -filter mhl.forw-test -annotate -inplace Ignore "-annotate" and "-inplace" if you don't use them. If you do, however, your forwarded messages will be marked as "replied to". If you want to get *really* fancy and annotate them properly, I can build you a shell script which will do this, albeit imperfectly. 4. Note: you can no longer forward more than one message at a time! -Peter #---------------------------------- cut here ---------------------------------- # This is a shell archive. Remove anything before this line, # then unpack it by saving it in a file and typing "sh file". # # Wrapped by marvit at hplpm on Wed Dec 16 09:46:10 1987 # # This archive contains: # mhl.forw-test forw-test.form # # Existing files will not be overwritten. # Modification/access file times will be preserved. # Error checking via wc(1) will be performed. # Error checking via sum(1) will be performed. if test -f mhl.forw-test then echo Will not overwrite existing file mhl.forw-test exit 1 fi echo x - mhl.forw-test sed 's/^@//' >mhl.forw-test <<'@EOF' width=133,overflowtext=,overflowoffset=10 leftadjust,compress,compwidth=9 : :------- Forwarded Message : Date:formatfield="%<(nodate{text})%{text}%|%(tws{text})%>" @From: To: cc: Subject: : body:nocomponent,width=133,overflowoffset=0,noleftadjust,nocompress : :------- End of Forwarded Message @EOF set -- `sum <mhl.forw-test`; if test $1 -ne 25958 then echo ERROR: mhl.forw-test checksum is $1 should be 25958 fi if test "`wc -lwc <mhl.forw-test`" != ' 14 20 293' then echo ERROR: wc results of mhl.forw-test are `wc -lwc <mhl.forw-test` sh ould be 14 20 293 fi touce -m 1216093787 mhl.forw-test touch -a 1216094587 mhl.forw-test chmod 644 mhl.forw-test if test -f forw-test.form then echo Will not overwrite existing file forw-test.form exit 1 fi echo x - forw-test.form sed 's/^@//' >forw-test.form <<'@EOF' To: \n\ cc: \n\ bcc: \n\ fcc: \n\ @From: Peter Marvit <marvit@hplpm@hplabs.hp.com>\n\ X-Mailer: mh6.5\n\ %<{subject}Subject: [Forwarded:] %{subject}\n%>\ -------- @EOF set -- `sum <forw-test.form`; if test $1 -ne 13693 then echo ERROR: forw-test.form checksum is $1 should be 13693 fi if test "`wc -lwc <forw-test.form`" != ' 8 18 162' then echo ERROR: wc results of forw-test.form are `wc -lwc <forw-test.form` should be 8 18 162 fi touch -m 1216092587 forw-test.form touch -a 1216094587 forw-test.form chmod 664 forw-test.form exit 0 #---------------------------------- cut here ----------------------------------
leres@ace.ee.lbl.gov (Craig Leres) (11/29/89)
Christian LOTITO writes: > i'd like the cmd 'forw' to fill the subject field automatically > with the subject of the message to be forwarded. Here's what Jef Poskanzer and I came up with; a script that uses repl in a novel manner. It only works when your forwarding one message. Crude, but effective. Craig ------ #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # forw # forw1.comps # forw1.mhl # This archive created: Wed Nov 29 02:44:37 1989 export PATH; PATH=/bin:$PATH echo shar: extracting "'forw'" '(549 characters)' if test -f 'forw' then echo shar: will not over-write existing file "'forw'" else sed 's/^X//' << \SHAR_EOF > 'forw' X#!/bin/csh -f X# X# forw - use repl to forward a single message, otherwise fall back on forw X# X# v01b - 18Jan89 - Craig Leres X# v01a - 29jul87 - Jef Poskanzer X Xset realforw=/usr/new/mh/forw X Xforeach a ( $* ) X switch ( "$a" ) X case *-*: X case *:*: X case all: X case -dashmunging: X $realforw $* X exit 0 X case +*: X case -*: X breaksw X default: X if ( $?foundsingle ) then X $realforw $* X exit 0 X endif X set foundsingle X breaksw X endsw Xend X X# Only one message, handle specially. Xrepl -form forw1.comps -filter forw1.mhl $* SHAR_EOF if test 549 -ne "`wc -c < 'forw'`" then echo shar: error transmitting "'forw'" '(should have been 549 characters)' fi chmod +x 'forw' fi # end of overwriting check echo shar: extracting "'forw1.comps'" '(59 characters)' if test -f 'forw1.comps' then echo shar: will not over-write existing file "'forw1.comps'" else sed 's/^X//' << \SHAR_EOF > 'forw1.comps' XTo: XSubject: %<{subject}Re: %67(trim)%(putstr)%> X-------- SHAR_EOF if test 59 -ne "`wc -c < 'forw1.comps'`" then echo shar: error transmitting "'forw1.comps'" '(should have been 59 characters)' fi fi # end of overwriting check echo shar: extracting "'forw1.mhl'" '(603 characters)' if test -f 'forw1.mhl' then echo shar: will not over-write existing file "'forw1.mhl'" else sed 's/^X//' << \SHAR_EOF > 'forw1.mhl' X: X:------- Forwarded Message X: Xignores=approved,date-received,distribution,followup-to,in-reply-to,keywords,lines,message-id,newsgroups,nf-id,organization,original-date,path,posting-version,received,relay-version,resent-message-id,status,x-mailer,x-orig-date,x-orig-from,x-orig-message-id,x-st-status,x-st-vmsmail-to,x-sun-spots-digest,xref XDate:leftadjust XFrom:leftadjust XSubject:leftadjust XTo:leftadjust XCc:leftadjust XResent-Date:leftadjust XResent-From:leftadjust XResent-To:leftadjust Xextras:nocomponent,leftadjust,compress,overflowtext=" " X: Xbody:nocomponent X: X:------- End of Forwarded Message X: SHAR_EOF if test 603 -ne "`wc -c < 'forw1.mhl'`" then echo shar: error transmitting "'forw1.mhl'" '(should have been 603 characters)' fi fi # end of overwriting check # End of shell archive exit 0