[comp.mail.sendmail] How to tell RS6000 to use relay host

jackv@turnkey.tcc.com (Jack F. Vogel) (05/29/91)

In article <1991May28.133258.22855@unidui.uni-duisburg.de> hm292hu@unidui.uni-duisburg.de (Fred Hucht) writes:
>Hello everybody in the Netlands.
>We are using both HP9000/834 and IBM RS6000/320 to send mail to the world.
>While the sendmail.cf file on the HP has a stanza to tell sendmail to use a
>relay host when sending mail to a internet-adress, the sendmail.cf on the
>RS6000 hasn't. With the HP I can send mail without problems, on the RS6000 I
>often get my mail back with the message: <connection refused> or 
><host unknown>.
 
OK, this gets asked every once and a while, so here goes. You Level 2 folk
in Austin or the keeper of the FAQ if such a thing exists now should take
notes so I don't have to do this again...

First, make sure you save a copy of your original sendmail.cf so if you
hopelessly f*ck up you can recover :-}.

Second, there is the really simple relayhost scenario and the not-so-simple
one. I am only going to give rewrite rules for the simple case, if you have
need of the not-so-simple case you should have the talent to extrapolate
or you shouldn't be working in that environment :-}. The simple case is
where your system only knows 2 kinds of mail: local and everything else;
if its local well that's obvious, everything else you just want to send
of to this "smart" system, the relay host. The not-so-simple case is what
we have at locus.com, a network whether just local or wide area, so for
some hosts you want to send email SMTP, but you don't connect to the real
Internet so for all other domains you want to send email off to the relay
host which can handle real Internet mail. The opposite end of the spectrum,
and unfortunately the scenario for which the 6000's sendmail.cf was
designed, is where you are really on the Internet and you expect name
service to resolve everything and be able to talk SMTP to the world :-}.

Now for the details, the sendmail.cf I am referencing is from a pre-GA
system but I don't expect it has changed much. The sccsid at line 1 reads:
	"com/cmd/send,3.1,9005J, AIX 2/22/90 12:01:57"
If there are changes you will have to compensate...

1) You will probably want to enable the UUCP relay host as well as defining
   the new Internet relay host. At line 171 you will find within a large
   comment the string DUHostWithModems, this is who you will send any 
   email of the form 'user@host.UUCP' to. Make an entry below the comment
   of the form DUuucphost where the string 'uucphost' is replaced with
   the name of the site you want to send such email to. It may or may not
   be the same as the 'relayhost'. There is one small catch to using this
   facility, the rewrite rules in Ruleset 0 assume that you connect to 
   this uucp gateway via TCP/IP, if you want to use a site that you
   connect to via uucp it won't work. To correct this assumption take a
   look at line 1019-21, these lines should be commented out, and then
   replaced with copies with the string '#tcp' replaced with '#$M', which
   is a mailer macro which we will define in a moment.

2) Now to define our relayhost, just below the UUCP relay host insert the
   following lines:

	# Define our Internet mail gateway
	DRuunet

	# Define the mailer to reach the Internet gateway
	DMuucp

   Naturally, these must be at the beginning of the line, and the string
   'uunet' would be replaced with the sitename you wish to define, and
   'uucp' with the mailer used.

3) OK, so far all we have done is define a couple of new macros, anybody
   can do that :-}, the meaty question is what to do with them... Well,
   take a look at line 1037 (or thereabouts). You will see a rewrite rule
   that looks like:

	R$*<@$+>$*	$#tcp$@$2$:$1<@$2>$3

   This translates into sending any address of the form 'user@host{.domain}'
   via the tcp mailer to that host. This is the rule that we must change.
   Instead of "talking via the tcp mailer" to anything with a domain-based
   address, we want to send it to the relayhost via the mailer macro
   that we defined above. So comment out the line as it appears and replace
   it with the following:

	R$*<@$+>$*	$#$M$@$R$:$1<@$2>$3

   Be very careful to get the expressions EXACTLY right, also the field
   delimiting the left and right expressions should be tabs. This says
   anything with a domain-style address should be sent via the mailer
   that we specified to our relayhost for delivery: '$M' instantiates
   the DM macro definition and '$R' likewise DR. Got it?

4) I know I said I wouldn't cover the not-so-simple case but I will give
   a few clues. If you have your own domain with some number of hosts
   that you can talk SMTP with, then you want to distinguish addresses
   of the form 'user@host.ourdomain' from 'user@host.notourdomain',
   passing the former to the tcp mailer and the latter to the relayhost.
   This can be done using the 'D' macro. What you need to do is check
   for anything of the form '$*<@$-.$D>$*' and go ahead and resolve
   that to the tcp mailer. This can be further sophisticated by using
   the 'E,F,G' macros for handling subdomains, etc.

Well, hope this helps, and I hope this can get into the FAQ, or better
yet, the default sendmail.cf fixed to handle this. As I said, BE CAREFUL
when making any changes, and naturally, you do so at your own risk.

Cheers, and as always I do not speak officially for LCC or IBM.

-- 
Jack F. Vogel			jackv@locus.com
AIX370 Technical Support	       - or -
Locus Computing Corp.		jackv@turnkey.TCC.COM