🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nn
2 messages
2 total messages Started by Bill Dunn Sun, 15 May 1994 18:49
?How to use elm aliases within nn?
#5861
Author: Bill Dunn
Date: Sun, 15 May 1994 18:49
10 lines
1305 bytes
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?
-- 
William G. Dunn    76104.72@compuserve.com, wdunn@access.digex.net
Re: ?How to use elm aliases within nn?
#5888
Author: Robert Joop
Date: Tue, 24 May 1994 21:05
170 lines
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads