[comp.unix.ultrix] Mailer defn flags and the 'From:' field

moore@thud.cs.utk.edu (Keith Moore) (01/10/91)

In article <2198@aber-cs.UUCP>, aem@aber-cs.UUCP (Alec D.E. Muffett) writes:
|> Can somebody PLEASE send me a explanation of all the builtin flags that
|> can appear in a "F=......," field of a mailer definition.  According to
|> the SunOS4.0 manual I have here, I understand:-
|> 
|> 	f (or r) = pass sender name to mailer
|> 	S	 = don't setuid to another user when calling this mailer
|> 	l	 = mailer will perform local delivery
|> 	s	 = strip quotes and backslashes
|> 	m	 = can batch mail through
|> 	e	 = expensive
|> 	C	 = tag source domain onto outgoing 'From:' data
|> 
|> There are also flags relevant to the H?x? bits of header definitions,
|> but I know which ones they are, and there are a few flags (eg: 'n', 's')
|> which I don't have documented.

Here's some notes I've cobbled together on the subject.   YMMV.
------------------------------------------------------------------------------
Mailer flags:

'B' "M_BSMTP" (IDA only):

When sending mail out via SMTP, don't try to read replies.  Instead,
assume that the commands always succeeded.  This is for use when
creating a BSMTP (Batched SMTP) envelope around a message to send
to a remote system over a file-transfer-based transport.  This is
most often used on RSCS/NJE protocols (BITNET networks), but can
also be used with UUCP if the remote site accepts BSMTP traffic.

'C' M_CANONICAL:

This is used for when remote systems don't supply fully-qualified
domain names.  The sender's address is passed through ruleset 0 to see
whether it was valid.  This has the side effect of determining what
mailer it would go through if a piece of mail were sent to that
address.  If that mailer has the 'C' flag set, the From: addresses in
the message will have a domain appended if necessary.

'e' M_EXPENSIVE:

If the mailer is marked as "expensive" with the 'e' flag, mail will
not be delivered immediately, but only during a "queue run" (i.e.
either when sendmail is invoked with -q to flush the queue or when
sendmail is running as a daemon and periodically tries to send
everything in its mail queue).

'E' M_ESCFROM:

If this flag is set, check each line of the message to see if it begins
with "From".  If so, prepend a '>' to the beginning of the line.  This
is for use when sending mail to files, since UNIX mail files traditionally
seperate messages with lines starting with "From {address} {date}".

'F' M_FOPT:

This program needs an '-f sender-address' command-line option so it will
know who sent the message.

'h' M_HST_UPPER:

If this flag is set, the "host" or "domain" part of the address will not
be lowercased by sendmail.

'H' (Ultrix)

If this flag is set, send the (undocumented, unofficial, DEC-specific)
'HEAD' SMTP command to the mailer.  If the mailer responds with 2xx or
3xx reply code, send headers (and message body?) before sending
recipients.  DEC's DECnet mailer and their gateway to message router
require this option.

'I' M_INTERNAL:

Use the 'VERB' and 'ONEX' commands when talking to a remote SMTP server
through this mailer.  'VERB' tells the remote SMTP server to send back
verbose messages, each preceeded by a '0xx' error code, before sending
back the final SMTP reply which has a real error code (beginning with
digit 1-5).  'ONEX' tells the remote SMTP server that only a single
message will be sent, which helps the remote SMTP economize use of
machine time.

Basically you may set the 'I' flag when you know that the remote SMTP
server also runs sendmail.  Other SMTP servers may also accept these
commands.

'l' M_LOCAL:

1.  If this flag is set, and the message has a Return-receipt-to:
header, a message indicating the message has been received will be
sent to the sender.

2.  If this flag is set, and delivery of a message to $user fails, and
there is a local user or alias named owner-$user, an error message is
mailed to owner-$user.

3.  Mailers with this flag set do not need a "host" argument when the
mailer is called from ruleset 0.

'L' M_LIMITS:

1.  Strip out 0200 bits from the message stream.

2.  Truncate lines longer than 990 characters.

(These are both intended for use with the SMTP protocol)

'm' M_MUSER:

This flag indicates that the mailer can handle multiple recipients.
If this flag is set, and the message has multiple recipients for this
host, send the message once to all recipients in a single transaction.
(Or send the message to as many recipients at a time as can be
included on the command line or will fit in memory).  If the flag is
not set, send the message to each recipient seperately.  

If the mailer cannot return delivery status (success, failure, or
temporary failure) individually for each recipient, and cannot 
queue temporary failures for later retry and mail back notification
of errors on failed messages, you don't want to set this flag.

'n' M_NHDR

If this flag is *not* set, a "From {user} {date}" line is prepended to
each outgoing message.  This feature is only for UUCP, local, file, or
program mailers -- other mailers like TCP and DECnet should not have
this flag.

'p' M_FROMPATH

1.  For mailers which have the 'n' flag set, prepend {hostname}! (the k
macro in IDA sendmail) to the return address generated for the "From
{address} {date}" line.  (Probably need this flag for UUCP mailers).

2.  For SMTP mailers, prepend @local.domain: (or @local.domain,) to
the return path supplied in the MAIL FROM:<> command.  (But not if
this mailer is named "local"...see information on the Local Mailer).

'r' M_ROPT:

Just like the 'f' flag except that this mailer wants '-r'
{sender-address} instead.

'R' M_SECURE_PORT (not implemented in BSD or IDA, don't know about others):

Try to send SMTP traffic on a reserved TCP port.

's' M_STRIPQ

This flag is set if the mailer doesn't understand quoted strings in
recipient addresses.  If this flag is set, double quotes are removed
from recipient addresses before calling the mailer.  If this flag is
not set, only backslash quotes are removed.

There seems to be no way to retain both kinds of quoting in envelope
addresses.  This prevents sendmail from correctly handling addresses
of the form "quoted-string-containing-\"backslash-quotes\""@domain,
which is perfectly legal in SMTP, and sometimes occurs in gatewayed
mail.

'S' M_RESTR:

If this flag is *not* set, sendmail changes its uid and gid to either
that of the user that invoked sendmail, or to the default uid/gid
(from the sendmail config file) if the message came from elsewhere.

If this flag is set, sendmail runs the mailer with its own effective
uid/gid, usually root/daemon.  This should be used only when the
mailer program requires special privileges.

'u' M_USR_UPPER

If set, don't lowercase the user portion of the address before
sending.

'U' M_UGLYUUCP

If this flag is set, prepend a "From " line of the form
"From {address} {date} remote from {host}"
instead of
"From {host}!{address} {date}"
where {host} is the uucp name of the local machine, and
{address} is the return address relative to the local machine.

This format is required by some UUCP implementations -- set it if
one of your UUCP neighbors needs it.  (Probably set it any for the
UUCP mailer just to be safe.)

None of this happens if the 'n' flag is set.

'V' M_RELATIVIZE (IDA)

This flag applies to UUCP address syntax.  If a message is being sent
to UUCP node "foo", and the address is of the form
"foo!something!user", remove the "foo!" before sending.  Otherwise,
prepend "from!" to the address, where from is the local UUCP node
name.  This takes place *after* all ruleset-based rewriting.

This should probably never be used.  It's bad form to rewrite UUCP
header addresses, unless gatewaying mail into or out of the UUCP
world, (in which case this hack is useless) and rewriting of UUCP
envelope addresses is better done elsewhere.

'x' (Ultrix)

Use the (unofficial, undocumented, DEC-specific) 'MULT' SMTP command
to ask the remote SMTP whether it will send multiple reply codes (one
for each recipient) after accepting the message with the DATA command.
If the SMTP reply code is 250, sender sendmail will expect multiple
reply codes, otherwise sendmail expects a single reply code.

If the 'x' flag is not set, sendmail expects a single reply code.

'X' M_XDOT

When sending SMTP messages, if a line begins with '.', prepend another
dot.  (The receiving SMTP will remove the first dot from any line; a
line containing only a dot in column 1 terminates the message.)  This
behavior is required by RFC821 for SMTP traffic.
------------------------------------------------------------------------------
|> However, my main problem is that we are a multihost site, with one
|> gateway running Ultrix 4.0 (Sendmail 5.57, zilch documentation) talking
|> to the network.  Our Ultrix came with the UK sendmail compiler v1.4
|> (v2.1 is better looking, but I can't afford to play with it at the
|> moment, so I'm using the dealer-supplied stuff).

First thing to do is get something more recent than 5.57.  There are lots
of bugs with older sendmails.  Maybe they've fixed them, maybe they haven't.

|> I'm hand-tooling a client sendmail.cf to send *all* mail via "[IPC]" to
|> this one gateway, which fires it off to the world using a UKsm-generated
|> sendmail.cf file.
|> 
|> Problem/annoyance: Internal mail from a client, passed to the gateway
|> and delivered to the user gets a unix type
|> 
|> 	From <user> at <ctime format date>
|> 
|> but DOES NOT get
|> 
|> 	From: username blah blah <address>
|> 
|> as is supposed to be generated in the headers by
|> 
|> 	H?F?From: $q

This says "generate a From: header if one does not exist."  I don't
think sendmail ever *deletes* headers.

--
Keith Moore / U.Tenn CS Dept / 107 Ayres Hall / Knoxville TN  37996-1301
Internet: moore@cs.utk.edu      BITNET: moore@utkvx