Article View: news.software.readers
Article #75849Re: [mutt|slrn] feeding mail/article to external _interactive_ process
From: Thomas Roessler
Date: Mon, 09 Apr 2001 14:36
Date: Mon, 09 Apr 2001 14:36
137 lines
4143 bytes
4143 bytes
I'm seeing this from comp.mail.mutt, and I'm not entirely sure what
you try to do....
J�rg Ziefle <gt4556a@acmex.gatech.edu> writes:
>Correct me if I'm wrong, but to my knowledge, it is not possible with
>mutt and slrn to feed a mail to an external program that is then
>executed interactively. (I checked the last time in fall of last year.)
Maybe this is what you'd like to achieve?
------------------------------ BEGIN slrn-mua.sl
%
% replacement forward and reply functions for slrn.
% these will drop you to your normal mail user agent.
%
variable mua_script="/home/roessler/bin/slrn-mua";
define my_reply_to_article ()
{
pipe_article (Sprintf ("%s -reply", mua_script, 1));
}
define my_forward_article ()
{
pipe_article (Sprintf ("%s -forward", mua_script, 1));
}
definekey ("my_reply_to_article", "r", "article");
definekey ("my_forward_article", "F", "article");
------------------------------ END slrn-mua.sl
------------------------------ BEGIN ~/bin/slrn-mua
#!/bin/sh --
#
# A small script which is used to reply to or forward an
# article from within slrn.
#
# The article is expected to come on stdin, while $1 is either
# -reply or -forward.
#
# where is mutt located?
MUTT=/usr/local/bin/mutt
# where is formail?
FORMAIL=/usr/bin/formail
TMPDIR=${TMPDIR-/tmp}/`basename $0`.$$
mkdir -m 0700 $TMPDIR || { echo "can't create $TMPDIR!" >& 2 ; exit ; }
trap "rm -rf $TMPDIR; trap '' 0; exit" 0 1 2 3 4
cat > $TMPDIR/article
# get various headers
SUBJECT="`formail -z -x Subject: < $TMPDIR/article`"
DATE="`formail -z -x Date: < $TMPDIR/article`"
FROM="`formail -z -x From: < $TMPDIR/article`"
REPLY_TO="`formail -z -x Reply-To: < $TMPDIR/article`"
MESSAGE_ID="`formail -z -x Message-ID: < $TMPDIR/article`"
REFERENCES="`formail -z -x References: < $TMPDIR/article`"
exec > $TMPDIR/template
#
# functions
#
prepare_reply () {
if [ -n "$REPLY_TO" ] ; then
echo "To: $REPLY_TO"
else
echo "To: $FROM"
fi
if [ -n "$MESSAGE_ID" ] ; then
echo "In-Reply-To: $MESSAGE_ID"
echo "References: $REFERENCES $MESSAGE_ID"
fi
echo -n "Subject: "
if [ -z "$SUBJECT" ] ; then
echo "Re: your mail"
else
echo -n "Re: "
echo "$SUBJECT" | sed -e 's/^Re: *//'
fi
echo
echo "On $DATE, $FROM wrote:" | fmt
sed -e 's/^/> /' $TMPDIR/article
}
prepare_forward () {
echo "Subject: Fwd: $SUBJECT"
echo
echo "----- Forwarded message -----"
cat $TMPDIR/article
echo
echo "---- End forwarded message-----"
}
#
# main
#
case "$1" in
-reply)
prepare_reply
;;
-forward)
prepare_forward
;;
*)
echo "usage: `basename $0` {-reply|-forward}" >& 2
exit 1
;;
esac
exec > /dev/tty
$MUTT -H $TMPDIR/template < /dev/tty
------------------------------ END ~/bin/slrn-mua
--
Thomas Roessler <roessler@does-not-exist.org>
Technical Details
Message-ID:
<slrn9d3a7t.tun.roessler@sobolev.does-not-exist.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-comp.mail.mutt.mbox.zip!supernews.google.com!sn-xit-03!supernews.com!freenix!fr.usenet-edu.net!usenet-edu.net!fr.clara.net!heighliner.fr.clara.net!grolier!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!netnews.web.de!fu-berlin.de!uni-berlin.de!dialin244.pg4-nt.dusseldorf.nikoma.DE!not-for-mailReferences:
<slrn9d1s4k.nj2.gt4556a@acmex.gatech.edu>Show Full Headers
Complete Article Headers
Message-ID: <slrn9d3a7t.tun.roessler@sobolev.does-not-exist.org> Subject: Re: [mutt|slrn] feeding mail/article to external _interactive_ process Date: Mon, 09 Apr 2001 14:36:36 +0000 From: roessler@does-not-exist.org (Thomas Roessler) References: <slrn9d1s4k.nj2.gt4556a@acmex.gatech.edu> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-comp.mail.mutt.mbox.zip!supernews.google.com!sn-xit-03!supernews.com!freenix!fr.usenet-edu.net!usenet-edu.net!fr.clara.net!heighliner.fr.clara.net!grolier!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!netnews.web.de!fu-berlin.de!uni-berlin.de!dialin244.pg4-nt.dusseldorf.nikoma.DE!not-for-mail Newsgroups: comp.mail.mutt,news.software.readers Organization: Biting the Carpet. (TM) Lines: 136 NNTP-Posting-Host: dialin244.pg4-nt.dusseldorf.nikoma.de (213.54.99.244) Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: fu-berlin.de 986826996 6899928 213.54.99.244 (16 [29067]) X-Orig-Path: roessler User-Agent: slrn/0.9.6.2 (Linux)