Subject: Re: sendmail mailer flags and arguments

From: [email-masked] (Stephen R. van den Berg)
Date: Wed, 15 Sep 1993 20:00:56 +0200

Kevin Rodgers <[email-masked]> wrote:
>I've installed procmail under SunOS 4.1.3 as the local mail delivery
>agent for Sun's sendmail.  The directions for doing so in examples/
>advanced say:

>|The following lines should take the place of the standard Mlocal definition in
>|your sendmail.cf:

>|Mlocal, P=/usr/local/bin/procmail, F=lsSDFMhPfn, S=10, R=20,
>|	A=procmail -a $h -d $u

>   Why then is the `S' flag specified?  /usr/local/bin/procmail was
>   installed suid root (just like /bin/mail) by 'make suid'.

It is superfluous in your case.  Some people do not want procmail to
be suid root (if you *don't* make it suid root on SunOS, you open up
a security hole, BTW), in that case it would be needed.

The documentation originally listed both options (with and without the
'S' flag).  But, I learned that the more choices you give people, the
more they can do wrong.  Therefore, since adding the 'S' flag doesn't
hurt either, I decided to include it in the docs as "the preferred method".

>2. What is the utility of the `h' flag?  It seems the case of user names
>   (preserved by the `u' flag) might be of interest, but aren't host
>   names treated case-insensitively by the system libraries?

Don't use the 'u' flag.  It causes the /usr/lib/aliases resolvement to
become case-sensitive on some systems.  The 'h' flag makes sure that
the $h sendmail variable (passed to procmail in "-a $h") will not be
converted to lowercase.

>3. Does the absence of the `m' flag imply that procmail may be less
>   efficient than /bin/mail as a local delivery agent?

Yes and no.  Procmail can take the 'm' flag as well (again, giving people
too much options is never a good idea), and then it comes close to the
efficiency of /bin/mail.  However, using the 'm' flag is not always a good
idea because if sendmail does a "group"-delivery via procmail, procmail can
only return one exitcode for all recipients.  I.e. if even one of the
recipients can not be delivered to, the mail bounces from all of them.

Omitting the 'm' flag forces sendmail to invoke separate instances of
procmail for every recipient.  Making failure notification a lot more
precise.

>4. Concerning the "A=procmail -a $h -d $u" option, the procmail(1) man
>   page says:

>|     -a argument
>|          This will set $1 to be equal to argument.   It  can  be
>|          used  to pass meta information along to procmail.  This
>|          is typically done by passing along the $@x  information
>|          from the sendmail mailer rule.

># Sendmail's built-in macros:
>...
>#       $h      recipient host

>   But there's no indication in the procmail(1) man page that it accepts
>   a host name as an argument (in any position):

Correct.  Sendmail calls it a hostname, but for the local mailer (Mlocal),
this information is superfluous;  i.e. usually the local mailer does not
get or need a hostname (it can only be the local host).

>|     procmail [-pt] [-f fromwhom] [-a argument] -d recipient ...

But, sendmail (at least the newer versions), allow for a hostname to be
passed on to the local mailer.  This "hostname" can actually be filled
with whatever text you'd like (since the local mailer doesn't need a
hostname).

>   What is meant by "meta information"?

Thus, if you know how to write a sendmail rule, you can change the local
mailer rule so that some meta-information gets passed on to the local
mailer, disguised as a hostname.

Some sites use conventions like:

	[email-masked]

Sendmail takes apart the address and (for example) starts procmail with
the following arguments:

	procmail -a whatever -d joe

In your rcfile you can then query $1 to find out what meta-information
was packed in the mail-address.

>  Is $h equivalent to the
>   reference to "$@x"?

Basically, yes.
The sendmail rule that invokes procmail in the way I descibed above
should look like:

R$++$*	$#local $@$2 $:$1

And, it should be immediately followed by the default:

R$+	$#local $:$1

In order to catch mail without meta-information.

-- 
Sincerely,                                  [email-masked]
           Stephen R. van den Berg (AKA BuGless).    [email-masked]

"My name is Smith, the P is not pronounced."