This is the DECWRL version of utk-mail11 beta-1.7.  See ChangeLog for
details.  Note that this software is completely unsupported but we do
use it on the DECWRL gateway in preference to what ships with Ultrix.
Bug reports are welcome but we do not promise to reply or to do anything
to fix this software.  Paul Vixie <vixie@pa.dec.com>

This is the RFC822-to-mail11 portion of the mail11-to-Internet gateway.

utk-mail11 is designed to be called as a mailer from sendmail, though
I hope it is general enough to be used from other systems also.

Originally this program was compatible with DEC's mail11 program, supplied
with DECnet-Ultrix versions prior to 3.0.  Unfortunately, DEC changed
their mail11 program in version 3 to speak an undocumented version of
SMTP, so now you can only use DEC's gateway with DEC's version of
sendmail.  This gateway still resembles the old mail11 program, although
it may no longer be strictly compatible.

This code has been running on a VAX/Ultrix 3.0 machine for several
months with no major problems.  It has been minimally tested on
a Sun 3 running SunOS 3.5 and SunLink/DNI 5.0, and on a DecStation
3100 running Ultrix.

Please send bug reports/enhancements/suggestions/questions to:

moore@utkcs2.cs.utk.edu (Internet)
moore@utkvx (BITNET)
{uunet,gatech}!utkcs2.cs.utk.edu!moore (UUCP)

Keith Moore
107 Ayres Hall
Knoxville TN 37996-1301
USA

INSTALLATION:

Just type "make".  The makefile and Configure script are supposed to figure
out what kind of system you have and take it from there.

Edit the Makefile and take out the -DRECEIVED if you don't want to generate 
a Received: header.  Leave out the -DCC if you don't want to generate Cc: lines 
in the VMS MAIL header.  Even if enabled, Cc: headers will only be generated if
a Cc: header appears in the original message body, and if the remote MAIL-11
object also supports this feature.


SENDMAIL CONFIGURATION:

Sendmail config files vary widely, so I cannot give specific advice
here.  However, here are some useful things to keep in mind, followed
by appropriate portions from my sendmail.cf file:

1.  The remote DECnet node will automatically append the gateway's DECnet
node name to the VMS MAIL From: address.  Therefore, the sendmail rewrite
rules should strip the DECnet node name from any sender addresses.  
Recipient addresses should be in fully-qualified, including the gateway's DECnet 
node name as in GATEWAY::USER or GATEWAY::USER@DOMAIN, just so the DECnet
recipient doesn't think the addresses are local to his system.

2.  You can easily add pseudo-domains to your sendmail.cf file to allow
UNIX users to send mail through VMS MAIL-based gateways.  For example,
the rule

R$*<@$*.profs>		$# mail11 $@ profs-gw $: profs%$2::$1

lets you send PROFS formatted mail to users on IBM systems if you are running
JNET on the DECnet node profs-gw.

3.  Sendmail is brain-damaged about quotes.  It will preserve quoted
strings and treat them as single tokens while passing handling mail,
but if a quote within a quoted string appears in an envelope address,
it will strip the quote before passing it onto a mailer, regardless
of the 'preserve quotes' flag in the mailer description.  For example:
<"BITNET%\"MOORE@UTKVX\\""@NODE.DECNET>  becomes
<"BITNET%"MOORE@UTKVX""@NODE.DECnet>  ...which is completely wrong.

The best workaround I have come up with is to have sendmail strip
all quotes before sending the address to utk-mail11, and rely on
utk-mail11's address parsing routines to make sense of the address,
and requote it when necessary.


------------------------------------------------------------------------------
From sendmail.cf:

from ruleset 0:
[...]
# Handle DECnet mail addressed as user@node.decnet
R$+<@$+.decnet>		$# mail11 $@ $2 $: $1
# Handle DECnet mail addressed as node::user
R$+::$+			$# mail11 $@ $1 $: $2
# mail to PROFS gateway on UTKTX
R$*<@$+.profs>		$# mail11 $@ utkvx $: profs%$1@$2
# mail to ALL-IN-1 gateway on UTKVX3
R$*<@$+.allin1>		$# mail11 $@ utkvx3 $: mrgate::a1::$2::$1
[...]

mailer description:

Mmail11, P=/usr/local/lib/utk-mail11, F=nsF, S=17, R=27, A=mail11 $g $x $h $u
S17
# From: address processing
# strip local info
R@$j:$+			$2		local host name on the front
R@$=w:$+		$2
R@$=w.$=S:$+		$3
R@$U.DECNET:$+		$1
R$+@$j			$1		local host name on the end
R$+@$=w			$1
R$+@$=w.$D		$1
R$+@$U.DECNET		$1
R$*@$-.DECNET		$2::$1		change routing to DECnet syntax
R$+			$:$>5$1		change last % to @
R$*<$*>$*		$1$2$3		defocus again

S27
# recipient address processing
#
R$+@$j			$U::$1		if local name, change to DECnet syntax
R$+@$=w			$U::$1		(mostly for appearance's sake)
R$+@$=w.$=S		$U::$1
R$+@$-.DECNET		$2::$1		change routing to DECnet syntax
R$+			$:$>5$1		change last % to @
R$*<$*>$*		$1$2$3		defocus (undo ruleset 5 focusing)
