SMM:08-94
Sendmail Installation and Operation Guide
always be added, and can be used to trace messages.
There are a number of important points here. First, header fields are not added automati-
cally just because they are in the HdrInfo structure; they must be specified in the configuration
file in order to be added to the message. Any header fields mentioned in the configuration file
but not mentioned in the HdrInfo structure have default processing performed; that is, they are
added unless they were in the message already. Second, the HdrInfo structure only specifies
cliched processing; certain headers are processed specially by ad hoc code regardless of the sta-
tus specified in HdrInfo. For example, the "Sender:" and "From:" fields are always scanned on
ARPANET mail to determine the sender
24
; this is used to perform the "return to sender" func-
tion. The "From:" and "Full-Name:" fields are used to determine the full name of the sender if
possible; this is stored in the macro $x and used in a number of ways.
6.3.2. Restricting Use of Email
If it is necessary to restrict mail through a relay, the checkcompat routine can be modified.
This routine is called for every recipient address. It returns an exit status indicating the status of
the message. The status
EX_OK
accepts the address,
EX_TEMPFAIL
queues the message for a
later try, and other values (commonly
EX_UNAVAILABLE
) reject the message. It is up to check-
compat to print an error message (using usrerr) if the message is rejected. For example, check-
compat could read:
int
checkcompat(to, e)
register ADDRESS *to;
register ENVELOPE *e;
{
register STAB *s;
s = stab("private", ST_MAILER, ST_FIND);
if (s != NULL && e->e_from.q_mailer != LocalMailer &&
to->q_mailer == s->s_mailer)
{
usrerr("No private net mail allowed through this machine");
return (EX_UNAVAILABLE);
}
if (MsgSize > 50000 && bitnset(M_LOCALMAILER, to->q_mailer))
{
usrerr("Message too large for non-local delivery");
e->e_flags |= EF_NORETURN;
return (EX_UNAVAILABLE);
}
return (EX_OK);
}
This would reject messages greater than 50000 bytes unless they were local. The EF_NORE-
TURN flag can be set in e
e_flags to suppress the return of the actual body of the message in
the error return. The actual use of this routine is highly dependent on the implementation, and
use should be limited.
6.3.3. New Database Map Classes
New key maps can be added by creating a class initialization function and a lookup func-
tion. These are then added to the routine setupmaps.
24
Actually, this is no longer true in SMTP; this information is contained in the envelope. The older ARPANET protocols did
not completely distinguish envelope from header.