Article View: news.software.nn
Article #5888Re: ?How to use elm aliases within nn?
From: Robert Joop
Date: Tue, 24 May 1994 21:05
Date: Tue, 24 May 1994 21:05
170 lines
5042 bytes
5042 bytes
Bill Dunn <wdunn@access.digex.net> writes:
>How do I configure nn to use elm aliases when mailing News postings? For
>example: I'm reading this posting and want to send a copy to my account
>on the same machine -- hitting enter at the To: and Subject: prompts will
>send it to my account on the host machine with the News subject line;
>however, if I want to send it to my account on a different machine I have
>to explicitly type out the full name and domain address at the To: prompt
>even if I have an alias set up in elm. Any ideas?
you may wanna use the following perl script. (don't forget to strip my sig. :)
#!/usr/local/bin/perl
# File: nnelm
# Purposes:
# - expand elm aliases
# - transform to mail-safe encoding
# nnelm's behaviour can be influenced by specifying an X-nnelm: header
# with the following options:
# ascii text is ASCII, don't encode
# noenc don't encode (assumes 8bit clean channel)
# qp convert to quoted-printable
# b64 convert to base64
# This version doesn't use elm or fastmail to actually send the mail
# An elm utility is used to expand aliases only.
# � 1993, 1994 by Robert Joop <rj@rainbow.in-berlin.de>
$version = '3.1.1';
# Put the following line into your ~/.nn/init:
# set mailer nnelm
# The line
# unset mailer-pipe-input
# is *not* needed.
# This program automatically generates a Bcc: to oneself that can be
# redirected using procmail; put something like the following into your
# ~/.procmailrc:
# :2
# ^X-Mailer: nnelm
# ^From: rj
# nn-sent
# (you've got to replace `rj' with your userid.)
# --- configuration: ---
# command that expands elm aliases:
$expand = '/usr/local/bin/checkalias';
$commatospace = 1; # checkalias doesn't like commas :-(
$charset = 'ISO-8859-1';
# MIME encoding:
$encoding = 'quoted-printable';
# command that generates MIME $encoding:
if ($ENV{'DOMAIN'} eq 'tubcs')
{
$encoder = '/usr/elm/bin/mmencode';
}
else
{
$encoder = '/usr/local/bin/mmencode';
}
%encoders = ('quoted-printable', "$encoder -q", 'base64', "$encoder -b");
$encode = 1;
$encoding = 'quoted-printable';
# MTA:
$sendmail = '/usr/lib/sendmail -t';
$tmp = "/tmp/nnelm.$$";
# --- let's do it! ---
open (TMP, "> $tmp");
$hdr = '';
hdr_line: while (<>)
{
if ((/^$/ || !/^[ \t]/) && "$hdr" ne '')
{
# process header line:
if ($hdr =~ /^X-nnelm: /i)
{
$hdr =~ s/^X-nnelm: //i;
@args = split (/[\s,]+/, $hdr);
foreach $arg (@args)
{
if ($arg eq 'ascii')
{
$encode = 0;
$encoding = '7bit';
$charset = 'US-ASCII';
}
elsif ($arg eq 'noenc' || $arg eq 'no')
{
$encode = 0;
$encoding = '8bit';
}
elsif ($arg eq 'qp' || $arg =~ /^quote/)
{
$encode = 1;
$encoding = 'quoted-printable';
}
elsif ($arg eq 'b64' || $arg =~ /^base/)
{
$encode = 1;
$encoding = 'base64';
}
}
}
else
{
foreach $key (('To','Cc','Bcc','Reply-To'))
{
if ($hdr =~ /^$key: /i)
{
$hdr =~ s/^$key: //i;
$hdr =~ s/,/ /g if $commatospace;
$hdr = `$expand "$hdr"`;
$hdr =~ s/^Expands to: //i;
print TMP "$key: $hdr";
$hdr = '';
goto start;
}
}
print TMP "$hdr";
$hdr = '';
}
}
start:
last if /^$/;
$hdr .= "$_";
}
print TMP "Bcc: ", (getpwuid ($<))[0], " (instead of writing into =sent)\n";
print TMP "X-Mailer: nnelm $version (c) 1993, 1994 <rj@rainbow.in-berlin.de>\n";
print TMP "MIME-Version: 1.0\n";
print TMP "Content-Type: text/plain; charset=$charset\n";
print TMP "Content-Transfer-Encoding: $encoding\n";
print TMP "\n";
if ($encode)
{
close (TMP);
$encoder = $encoders{$encoding};
open (QUOTE, "| $encoder >> $tmp");
print QUOTE while (<>);
close (QUOTE);
}
else
{
print TMP while (<>);
close (TMP);
}
open (TMP, "< $tmp");
open (SENDMAIL, "| $sendmail");
while (<TMP>)
{
s/^\.$/. /;
print SENDMAIL;
}
close (SENDMAIL);
unlink ("$tmp");
best,
rj
--
__________________________________________________
Robert Joop
rj@{rainbow.in-berlin,fokus.gmd,cs.tu-berlin}.de
s=joop;ou=fokus;ou=berlin;p=gmd;a=d400;c=de
Technical Details
Message-ID:
<2rtq7i$4hm@rainbow.in-berlin.de>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.nn.mbox.zip!bga.com!news.sprintlink.net!demon!bnr.co.uk!corpgate!news.utdallas.edu!chpc.utexas.edu!cs.utexas.edu!howland.reston.ans.net!EU.net!Germany.EU.net!netmbx.de!unlisys!rainbow.in-berlin.de!rainbow.in-berlin.de!not-for-mailReferences:
<wdunn.769027459@access1>Show Full Headers
Complete Article Headers
Message-ID: <2rtq7i$4hm@rainbow.in-berlin.de> Subject: Re: ?How to use elm aliases within nn? Date: Tue, 24 May 1994 21:05:54 +0000 From: rj@rainbow.in-berlin.de (Robert Joop) References: <wdunn.769027459@access1> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.nn.mbox.zip!bga.com!news.sprintlink.net!demon!bnr.co.uk!corpgate!news.utdallas.edu!chpc.utexas.edu!cs.utexas.edu!howland.reston.ans.net!EU.net!Germany.EU.net!netmbx.de!unlisys!rainbow.in-berlin.de!rainbow.in-berlin.de!not-for-mail Newsgroups: news.software.nn Lines: 170 NNTP-Posting-Host: rainbow.in-berlin.de Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit