To: Paul Pomes <Paul-Pomes@uiuc.edu>
Subject: Here is some documentation on defining mailers.
Date: Thu, 30 May 91 16:24:19 -0500
From: Neil Rickert <rickert@cs.niu.edu>

The IDA configuration package comes with a standard set of mailers.  These
may not solve all the mailer requirements of users.  This document is
intended as a guide if you create your own mailer definition.

DEFINING A MAILER:

  The best way to start is to take an existing mailer and modify it to
suit your purposes.  Start by changing the mailer name.  The P= operand
defines the path to the program used.  The F= operand gives the mailer
flags, documented in 'SENDMAIL INSTALLATION AND OPERATION GUIDE'.
The S= and R= are the mailer specific rewrite rules, and you may need to
give these some thought.  The A= gives the argument list passed to the
mailer.

  To choose S= and R= operands, look for an existing mailer which creates
addresses in the format desired, and use those rulesets.  The commentary
on existing mailers toward the end of this document may help you in making
this choice.

WHERE TO PLACE THE MAILER DEFINITION:

  If you are just adding an additional mailer, the easiest approach it to
insert it at the end of your .m4 file, just after the 'include(Sendmail.mc)'.
If you need to change existing mailers, see if the options
UUCP_MAILER_DEF, LOCAL_MAILER_DEF and OTHER_MAILER_DEF (described in
Sendmail.mc) are useful for this purpose.

COMMENTARY ON SOME EXISTING MAILERS:

Mlocal,	P=/bin/mail, F=DFMlrmns,	R=25/10, S=10, A=mail -d $u

 This is the standard definition of the BSD local mailer.  The local mailer
is special, in that it normally only processes mail for local users on the
system.  However any mail directed to the local mailer first goes through
alias lookup and through .forward lookup.  The rewrite ruleset for
envelope recipients, ruleset 25 in this case, is used to format addresses
before the alias lookup.

 Ruleset 10 is designed to not append an '@local.domain.name' to local
addresses, but to do little other reformatting.  It will affect the
message headers and the envelope sender (the unix 'From ' line).  The
actual recipient addresses sent to /bin/mail are just normal user ids.
Ruleset 25 is there purely to handle the case where non-local aliasing is
being used, so that these aliases will be consistently formatted before using
to search the aliases database.

 Because of the 'r' flag, /bin/mail is actually called with the arguments
list:  mail -d user1 user2 ....   (for local senders) or the list:
mail -r sender -d user1 user2 ... (for non-local senders).

Mprog,	P=/bin/sh,  F=DFMhlsu, R=10, S=10, A=sh -c $u

 The prog mailer is used by sendmail for program mailers.  That is, if you
have an alias for:  |"/usr/ucb/vacation me", it is processed by the prog
mailer, after stripping of the leading '|'.  The result is that /bin/sh
is called with arguments:  sh -c "/usr/ucb/vacation me".  The rewrite rulesets
and flags of the prog mailer are also used for mailing to files.

MTCP,   P=[IPC], F=CDFMXhnmu, E=\r\n, R=10/11, S=11, A=IPC $h

 In the TCP mailer, we use ruleset 11 for most address rewriting.  Ruleset
11 formats addresses in the 'user@domain' format where possible.  If an
address is from our uucp neighbor 'uucpnode', the address 'uucpnode!user'
is transformed into the domain style 'uucpnode!user@our.domain.name'.
Note however that this does not happen to the envelope recipient, which is
processed instead by ruleset 10.  Since we might mail some UUCP addresses
via TCP, we must be careful not to create a mailing loop by routing the
direct envelope recipient through our domain.

MTCP-U, P=[IPC], F=CDFMXhnmu, E=\r\n, R=17/11, S=17/11, A=IPC $h

  The TCP-U mailer reformats header addresses with ruleset 11, just like the
regular TCP mailer.  The envelope addresses, however, are in a format closer
to UUCP bang paths, on the assumption that the receiving SMTP mailer will be
forwarding them on the next step by UUCP transport.

MUUCP-A, P=/usr/bin/uux, F=DFMmu, S=15/11, R=15/11, A=uux - -z -r $h!rmail ($u)

  The UUCP-A mailer uses UUCP format envelope addresses to keep the UUCP
UUCP transport software happy, but uses domain style header addresses.

MACSNET, P=/usr/spool/ACSnet/_lib/netmail, F=mDCFSMhun, R=10/11, S=11,
	A=ACSmail -amailer -s$g -u$u -d$h -n$i

 The ACSNET mailer might be useful for users in Australia.  It could be used
with a mailertable entry of:

ACSNET,%s.oz	.oz

so that addresses ending in '.oz' are sent via ACSNET.  (Taken from a user
in Australia, but since I modified some of the arguments, please consider
this only a guide - there are probably errors).  Note that the definition
can extend to two lines if the second begins with white space.  The
address rewrite rules are exactly the same as for the TCP mailer, since
that already produces the appropriate address format.

Mdeliver, P=/usr/local/bin/deliver, F=DFMlrmnus, R=25/10, S=10, A=deliver $u

 This is intended for Chip Salzenberg's 'deliver' package.  You might have
a mailertable definition something like:

deliver!localhost	deliver

so that an alias (or a user .forward) aliasing an address to 'name@deliver'
will cause deliver to be invoked.  Note that the rewrite rulesets are
identical to those used in the local mailer.

Mmailsh, P=/bin/sh, F=DFMhmus, R=11, S=11, A=sh /usr/lib/mailsh/$h.sh -r $g $u

 I am experimentally using this for shell scripts to handle mail problems such
as gatewaying news to mail.  Since the hostname is significant, and becomes
the name of the shell script to use, the 'l' (local) flag is not used.  Since
I want to use this for news, I am using the same rewrite rulesets as the TCP
mailer.  As a hypothetical example, I might want to have a mailertable entry:

mailsh!mnews	news.cs.niu.edu

so that a message addressed to:

	'comp.unix.wizards@news.cs.niu.edu, news.groups@news.cs.niu.edu'

would result in /bin/sh being called with arguments:

	sh -r sender /usr/lib/mailsh/mnews.sh comp.unix.wizards news.groups

and the appropriate shell script would be designed to inject this into the
news system cross posted to the two groups.  (Please don't try sending
mail to 'comp.unix.wizards@news.cs.niu.edu' to test this.  It will bounce
with a "host unknown" message.)


