start page | rating of books | rating of authors | reviews | copyrights

sendmail

sendmailSearch this book
Previous: 30.3 m4 Configuration Syntax Chapter 30
Delivery Agents
Next: 30.5 Internally Defined Names
 

30.4 The Equates

Recall that the form for the M command is

M

symname, equate, equate, equate, ...

Each equate expression is of the form

field=arg

The field is one of those in Table 30.1 . Only the first character of the field is recognized. That is, all of the following are equivalent:

S=21 Sender=21 SenderRuleSet=21

The field is followed by more optional whitespace, the mandatory = character, optional whitespace, and finally the arg . The form that the arg takes varies depending on the field . It may or may not be required.

Special characters can be embedded into the field as shown in Table 31.3 of Section 31.3.2, "Syntax of the Configuration File Macro's Text" . For example, the backslash notation can be used to embed commas and a newline character into the A= equate like this:

...    A=eatmail -F0\,12\,99 -E\n

The complete list of equates is shown in Table 30.1 . A full description of each begins in the next section. They are presented in alphabetical order rather than in the order in which they would appear in typical delivery agent definitions.

Table 30.1: Delivery Agent Equates
Equate Field Name Meaning
A= Argv Section 30.4.1, A= Delivery agent's command-line arguments
C= Charset Section 30.4.2, C= Default MIME character set (V8.7 and above)
D= Directory Section 30.4.3, D= Paths to directories for execution (V8.6 and above)
E= EOL Section 30.4.4, E= End-of-line string
F= Flags Section 30.4.5, F= Flags describing a delivery agent's behavior
L= Linelimit Section 30.4.6, L= Maximum line length (V8.1 and above)
M= Maximum Section 30.4.7 Maximum message size
N= Niceness Section 30.4.8, N= How to nice (2) the agent (V8.7 and above)
P= Path Section 30.4.9, P= Path to the delivery program
R= Recipient Section 30.4.10, R= Recipient rewriting rule set
S= Sender Section 30.4.11, S= Sender rewriting rule set
T= Type Section 30.4.12, T= Types for DSN diagnostics (V8.7 and above)
U= UID Section 30.4.13, U= Run agent as uid:gid (V8.7 and above)

30.4.1 A=

The argv for this delivery agent

(All versions)

The program that is to be run (specified by the P= equate) is given its C language char **argv array (list of command-line arguments) by this A= equate. This equate is traditionally the last one specified, because, prior to V8.7, the argv arguments were all those from the = to the end of the line:

Mlocal, P=/bin/mail, F=rlsDFMmnP, S=10, R=20, A=mail -d $u                                                 
-^
                                  
prior to V8.7, argv to end of line ->

Beginning with V8.7, the A= is treated like any other equate, in that it ends at the end of line or at the first comma. The backslash character can be used as a prefix to embed commas in the A= equate.

Macros are expanded and may be used in this argv array. For example,

A=mail -d $u

The A= begins the declaration of the argument array. The program that is specified by the P= equate ( /bin/mail ) will be executed with an argv of

argv[0] = "mail" argv[1] = "-d"              
<- switch means perform final delivery
 argv[2] = "fred"            
<- where macro 
$u
 contains "fred"

The macro value of $u contains the current recipient name (see Section 31.10.36, $u ). Another macro that commonly appears in A= fields is $h , the recipient host (see Section 31.10.17, $h ). You are, of course, free to use any macro you find necessary as a part of this argv array. Note that $u is special in that if it is missing, sendmail will speak SMTP to the delivery agent (see Section 30.4.1.3, "$u in A=" ). Also note that any arguments in excess of the maximum number defined by MAXPV (see Section 18.8.19, MAX... ), usually 40, are silently ignored.

30.4.1.1 m4 A= definitions

Under V8 sendmail 's m4 configuration you can define the A= equate using the values shown in the leftmost column of Table 30.2 . For example, to modify the A= equate for the local delivery agent, you might include this definition in your mc file:

define(`LOCAL_MAILER_ARGS', `put.local -d $u -l')dnl

Table 30.2: m4 Modification of A= Equates
define() Agent MAILER() Default A=
CYRUS_MAILER_ARGS cyrus cyrus deliver -e -m $h -- $u
CYRUS_BB_MAILER_ARGS cyrusbb cyrus deliver -e -m $u
FAX_MAILER_ARGS fax fax mailfax $u $h $f
LOCAL_MAILER_ARGS local local mail -d $u
LOCAL_SHELL_ARGS prog local sh -c $u
MAIL11_MAILER_ARGS mail11 mail11 mail11 $g $x $h $u
PH_MAILER_ARGS ph phquery phquery -- $u
POP_MAILER_ARGS pop pop pop $u
PROCMAIL_MAILER_ARGS procmail procmail procmail -m $h $f $u
SMTP_MAILER_ARGS smtp smtp IPC $h
SMTP8_MAILER_ARGS smtp8 smtp IPC $h
ESMTP_MAILER_ARGS esmtp smtp IPC $h
RELAY_MAILER_ARGS relay smtp IPC $h
USENET_MAILER_ARGS usenet usenet inews -m -h -n
UUCP_MAILER_ARGS uucp uucp uux - -r -a$g -gC $h!rmail ($u)

In general, the definitions in the _CF_DIR_/ostype subdirectory are pretuned in a way that is best for most sites. If you want to make changes, remember that each definition that you put in your mc file replaces the definition in _CF_DIR_/ostype . Therefore it's best to copy an existing definition and modify it for your own use. Just be sure you don't omit something important. (The _CF_DIR_ prefix is described in Section 19.2.1 .)

30.4.1.2 $h and other arguments in A=[IPC]

For network delivery via the P=[IPC] delivery agent, the A= equate is usually declared like this:

A=IPC $h

The value in $h is the value returned by rule set 0's $@ operator and is usually the name of the host to which sendmail should connect. During delivery the sendmail program expands this hostname into a possible list of MX records. [3] It attempts delivery to each MX record. If all delivery attempts fail and if the V8 FallbackMXhost ( V ) option (see Section 34.8.25, FallbackMXhost (V) ) is set, delivery is attempted to that fallback host. In all cases, if there are no MX records, delivery is attempted to the A record instead.

[3] Unless the V8.8 F=0 flag is set (see Section 30.8.1, F=0 ).

Beginning with V8 sendmail , $h (possibly as returned by rule set 0) can be a colon-separated list of hosts. The sendmail program attempts to connect to each in turn, left to right:

A=IPC 

hostA

:

hostB

:

hostC

Here, it tries to connect to hostA first. If that fails, it next tries hostB , and so on. As usual, trying a host means trying its MX records first, or its A record if there are no MX records.

The host (as $h ) is usually the only argument given to IPC . But, strictly speaking, IPC can accept three arguments, like this:

A=IPC 

hostlist

 

port

The port (third argument) is usually omitted and so defaults to 25. However, a port number can be included to force sendmail to connect on a different port.

To illustrate, consider the need to force mail to a gateway machine to be always delivered on a particular port. First, design a new delivery agent that uses IPC for transport.

Mgateway, P=[IPC], ..., A=IPC gateway.domain $h

Here, any mail that selects the gateway delivery agent is transported over the network (the [IPC] ) to the machine gateway.domain . The port number is carried in $h , which usually carries the hostname.

Next, design a rule in rule set 0 that selects this delivery agent:

R$+ < @ $+ .gateway > $*            $#gateway $@ 26 $: $1 < @ $2 .gateway> $3

This rule selects the gateway delivery agent for any address that ends in .gateway . The host part that is returned by the $@ is the port number to use. The $: part (the address) is passed in the envelope. Note that the gateway also has to be listening on the same port for this to work.

In the event that you wish to carry the port number in a macro, you may do so by specifying the host with $h . For example,

Mgateway, P=[IPC], ..., A=IPC 

$h $P

 R$+ < @ $+ .gateway > $*            $#gateway $@ 

$2

 $: $1 < @ $2 .gateway> $3

Then sendmail can be run with the command-line argument

-MP26

to cause gateway mail to go out on port 26.

30.4.1.3 $u in A=

The $u macro is special in the A= equate's field. If $u does not appear in the array, sendmail assumes the program in P= equate speaks SMTP. Consequently, you should never use a $u when defining mail delivery agents that speak SMTP. All agents that use [IPC] or [TCP] in their P= equate's field must use SMTP.

If $u does appear in the array, sendmail assumes that the program in P= does not speak SMTP.

If $u appears and the F=m delivery agent flag is also specified, then the argument containing $u is repeated as many times as there are recipients. For example, a typical uucp delivery agent definition looks like this:

Muucp, P=/bin/uux, F=

m

sDFMhuU, S=13, R=23, A=uux - -r $h!rmail (

$u

)                      
-^
                                          
-^
                      
note
                                      
note

In the above, the m flag is set in the F= equate's field, which tells sendmail that this delivery agent can deliver to multiple recipients simultaneously. The $u macro is also included as one of the arguments specified by the A= command-line array. Thus if mail is sent with this delivery agent to multiple recipients, say jim , bill , and joe , then the ($u) argument [4] is repeated three times, once for each recipient:

[4] When $u is used as part of a UUCP delivery agent's F=A array, it should be parenthesized. This is what the uux (1) program expects.

uux - -r $h!rmail (jim) (bill) (joe)

30.4.2 C=

The default MIME character set

(V8.7 and above)

The C= equate (introduced with V8.7 sendmail ) is used to define a default character set for use with the MIME Content-Type: header (see Section 35.10.9, Content-Type: ). If it is present, its value supersedes that of the DefaultCharSet option (see Section 34.8.14, DefaultCharSet ).

Note that the C= equate is examined only when the delivery agent is selected for a sender address.

When a mail message is converted from 8 to 7 bits (see the EightBitMode ( 8 ) option in Section 34.8.22, EightBitMode (8) ), it is important that the result looks like a MIME message. V8.7 sendmail first outputs the following header (if one is not already present):

MIME-Version: 1.0

Next, V8.7 sendmail looks for a Content-Type: header (see Section 35.10.9 ). If none is found, the following is inserted, where charset is the value declared for the C= equate of the sender's delivery agent:

Content-Type: text/plain; charset=

charset

If the argument to the C= is missing, the following error is printed and the C= becomes undefined:

mailer 

agent_name

: null charset

If the C= equate is undefined in your configuration file, charset defaults to the value of the DefaultCharSet option. If both are undefined, the value for charset becomes "unknown-8bit."

30.4.3 D=

Paths to directories for execution

(V8.6 and above)

Ordinarily, whenever sendmail executes a program via the prog delivery agent, it does so from within the sendmail queue directory. One unfortunate side effect of this behavior is that shell scripts written with the C-shell (and possibly other programs) may fail because they cannot stat (2) the current directory. To alleviate this problem, V8 sendmail has introduced the D= delivery agent equate. This new equate allows you to specify a series of directories for sendmail to attempt to chdir (2) into before invoking the delivery program.

The form of the D= equate looks like this:

D=

path1

:

path2

...

The D= is followed by a colon-separated series of directory pathnames. Before running the delivery program, sendmail tries to chdir (2) into each in turn, leftmost to rightmost, until it succeeds. If it does not succeed with any of the directories (perhaps because none of them exist), sendmail remains in its queue directory.

One recommended setting for the D= equate is this:

D=$z:/tmp

Here, sendmail first tries to chdir (2) into the directory defined by the $z macro (see Section 31.10.46, $z ). That macro either contains the full pathname of the recipient's home directory or is NULL. If it is NULL or if the home directory is unavailable, the chdir (2) fails, and sendmail instead does a chdir (2) to the /tmp directory.

In using V8 sendmail 's m4 configuration, the value given to D= can be easily changed only for the prog delivery agent, which defaults to

D=$z:/

For prog it can be redefined by using LOCAL_SHELL_DIR, as, for example,

define(`LOCAL_SHELL_DIR', `$z:/var/tmp')dnl MAILER(local)

Here, LOCAL_SHELL_DIR is given a new value before the prog delivery agent is loaded (via the local ).

For all other delivery agents you must first copy an existing delivery agent definition, then modify it as outlined in Section 30.3.1, "Tuning Without an Appropriate Keyword" .

If the D= argument is missing, the following error is printed and the D= becomes undefined:

mailer 

agent_name

: null working directory

The chdir (2) process can be traced with the -d11.20 debugging switch (see Section 37.5.46, -d11.20 ).

30.4.4 E=

The end-of-line string

(All versions)

The E= equate specifies the end-of-line character or characters. Those characters are generated by sendmail for outgoing messages and recognized by sendmail for incoming messages.

The end-of-line characters are defined with the E= equate as backslash-escaped control characters, such as

E=\r\n

Prior to V8.8 the default end-of-line string, if the E= field was missing, was the C language newline character, \n . [5] Beginning with V8.8 sendmail , the default is \n for all but delivery agents that speak SMTP, in which case the default is \r\n .

[5] On some NeXT computers (prior to OS version 2.0) the default E= terminator is \r\n . This can cause serious problems when used with some non-TCP delivery agents like UUCP. If you have a system that does this, you can override that improper default with E=\n .

In general, delivery agents that speak SMTP (those that lack a $u in the A= argument array, should have their end-of-line field set to E=\r\n (for a carriage return/line feed pair). [6] Delivery agents that do not speak SMTP (those that include a $u in the A= argument array) should have their end-of-line field set to E=\n (for a lone linefeed character).

[6] line feed is the same ASCII character as newline.

In using V8 sendmail 's m4 configuration, the value given to E= cannot be easily changed. It is supplied to the MAILER(smtp) delivery agents as \r\n but is left as the default \n for all others. If you need to change this value at the m4 level, you must first copy an existing delivery agent definition, then modify it as outlined in Section 30.3.1 .

If the E= equate's argument is missing, the following error message is printed and the E= becomes undefined:

mailer 

agent_name

: null end-of-line string

30.4.5 F=

Flags describing a delivery agent's behavior

(All versions)

The F= equate is probably more fraught with peril than the others. The flags specified with F= tell sendmail how the delivery agent will behave and what its needs will be. These flags are used in one or more of three ways:

First, if a header definition relies conditionally on a flag:

H?

P

?Return-Path: <$g>   
-^
   
apply if P flag specified in F= equate.

and if that flag is listed as a part of the F= equate:

Mlocal, P=/bin/mail, F=rlsDFMmn

P

, S=10, R=20, A=mail -d $u                                
-^
                                
apply in header

then that header is included in all mail messages that are sent via this delivery agent.

Second, if a delivery agent needs a special command-line argument that sendmail can produce for it but requires that argument only under special circumstances, selected F= flags can produce that result. For example, the F=f flag specifies that the delivery agent needs a -f command-line switch when it is forwarding network mail.

Third, the F= flags also tell sendmail how this particular delivery agent behaves. For example, it performs final delivery or requires uppercase preserved for usernames.

Many flags have special meaning to sendmail ; others are strictly user-defined. All of the flags are detailed at the end of this chapter ( Section 30.8, "Alphabetized F= Flags" ).

Note that whitespace characters cannot be used as flags. Also note that flags OR together (they are really just bits), so they can be declared separately, for clarity, as in the following:

F=D,     # include Date: header if not present F=F,     # include From: header if not present F=7,     # strip the hi bit when delivering

Or they can be declared all together, with no change in meaning or effect, like this:

F=DF7,

Note that the argument following the F= is optional, and an empty declaration is silently ignored. Also note that the comma can be used as a flag by prefixing it with a backslash.

30.4.5.1 m4 modification of F=

When using V8 sendmail 's m4 configuration, you can modify various flags for inclusion with most delivery agents. As shown in Table 30.3 some modifications are made by appending the new flags to the original flags. Others are made by replacing a few flags with new ones and appending the result to the originals. For example, the following declaration:

define(`LOCAL_MAILER_FLAGS', `f')dnl

results in these flags being defined for the local delivery agent:

lsDFMAwq5:/|@f

Table 30.3: m4 Modification of F= Equates
define() Agent MAILER() Append to Replace
CYRUS_MAILER_FLAGS cyrus cyrus lsDFMnPq 5@A
CYRUS_MAILER_FLAGS cyrusbb cyrus lsDFMnPq
FAX_MAILER_FLAGS fax fax DFMhu
LOCAL_MAILER_FLAGS local local lsDFMAwq5:/|@ rmn
LOCAL_SHELL_FLAGS prog local lsDFMoq eu
MAIL11_MAILER_FLAGS mail11 mail11 nsFx
PH_MAILER_FLAGS ph phquery nrDFM ehmu
POP_MAILER_FLAGS pop pop lsDFMq Penu
PROCMAIL_MAILER_FLAGS procmail procmail DFMm Shu
SMTP_MAILER_FLAGS smtp smtp mDFMuX
SMTP_MAILER_FLAGS esmtp smtp mDFMuXa
SMTP_MAILER_FLAGS smtp8 smtp mDFMuX8
SMTP_MAILER_FLAGS relay smtp mDFMuXa8
USENET_MAILER_FLAGS usenet rlsDFMmn
UUCP_MAILER_FLAGS uucp uucp DFMhuUd
UUCP_MAILER_FLAGS uucp-old uucp DFMhuUd
UUCP_MAILER_FLAGS suucp uucp mDFMhuUd
UUCP_MAILER_FLAGS uucp-new uucp mDFMhuUd
UUCP_MAILER_FLAGS uucp-dom uucp mDFMhuUd
UUCP_MAILER_FLAGS uucp-uudom uucp mDFMhuUd

To append to flags or to replace them, use the appropriate definition from the left-most column of the table and make sure your definition precedes the MAILER m4 command, for example,

define(`SMTP_MAILER_FLAGS', `P')dnl                 
<- first
 MAILER(smtp)                                        
<- second

If you reverse them, the define will be silently ignored.

30.4.6 L=

Maximum line length

(V8.1 and above)

The L= equate is used to limit the length of text lines in the body of a mail message. If this equate is omitted and if the delivery agent has the obsolete F=L flag set (see Section 30.8.29, F=L ), sendmail defaults to SMTPLINELIM (990) as defined in conf.h (see Section 18.8.43, SMTPLINELIM ). If the F=L is clear (as it is in modern configuration files), sendmail defaults to 0. The F=L is honored for compatibility with older versions of sendmail that lack this L= equate.

Limiting line length causes overly long lines to be split. When an output line is split, the text up to the split is first transmitted, followed by the ! character. After that the characters defined by the E= equate are transmitted. A line may be split into two or more pieces. For example, consider the following text from the body of a mail message:

The maximum line length for SMTP mail is 990 characters. A delivery agent speaks SMTP when the $u macro is omitted from the A= equate.

A delivery agent could limit line length to 20 characters with a declaration of

L=20

With that limit, the above text would be split during transmission into the following lines:

The maximum line len! gth for SMTP mail is! 990 characters. But that length is o! nly enforced if the ! F=L flag is included in a delivery agent ! definition. A delive! ry agent speaks SMTP when the $u mac! ro is omitted from t! he A= equate.

Limiting the line length can find application with programs that can't handle long lines. A 40-character braille print-driving program might be one example.

If the argument to L= is missing or if it evaluates to 0 or less, the maximum line limit is set to zero, in which case no limit is enforced.

In using V8 sendmail 's m4 configuration, the default for the smtp , esmtp , and smtp8 delivery agents is 990. The default for the relay delivery agent is 2040. The default for all other delivery agents is 0. To change the default at the m4 level, copy an existing delivery agent definition and modify it as outlined in Section 30.3.1 .

30.4.7 M=

Maximum message size

(All versions)

The M= equate is used to limit the total size (header and body combined) of messages handled by a delivery agent. The form for the M= equate is

M=

nbytes

Here, nbytes is the ASCII representation of an integer that specifies the largest size in bytes that can be transmitted. If nbytes is missing, or if the entire M= equate is missing, nbytes becomes zero. If the value is zero, no checking is done for a maximum.

If the size of the message exceeds the limit specified, an error message is returned (bounced) that looks like this:

--- Transcript of session follows --- 552 <

recipient

>... Message is too large; 

nbytes

 bytes max

Bounced mail includes only a copy of the headers. The body is specifically not bounced. The DSN status is set to 5.2.3 (see RFC1893).

This equate is usually used with UUCP agents, where the cost of telephone connections is of concern. It may also find application in mail to files, where disk space is limited.

Prior to V8 sendmail , care had to be used to avoid setting M= to a non-zero value when the delivery agent had the F=e flag set. That flag tells sendmail that the delivery agent is expensive . If the c option is also set, expensive mail is queued rather than delivered. A problem arose because the size of the message was ignored when it was delivered from the queue, so no queued messages were ever bounced for exceeding the M= limit. This bug is fixed in V8 sendmail .

30.4.7.1 m4 modifications of M=

In using V8 sendmail 's m4 configuration, the maximum message size can be changed by using the definitions listed in the leftmost column of Table 30.4 .

Table 30.4: m4 Modification of M= Equates
define() Agent MAILER() Default M=
CYRUS_MAILER_MAX cyrus cyrus 0
CYRUS_MAILER_MAX cyrusbb cyrus 0
FAX_MAILER_MAX fax fax 100000
LOCAL_MAILER_MAX local local 0
LOCAL_MAILER_MAX prog local 0
none mail11 mail11 0
none ph phquery 0
none pop pop 0
PROCMAIL_MAILER_MAX procmail procmail 0
SMTP_MAILER_MAX smtp smtp 0
SMTP_MAILER_MAX esmtp smtp 0
SMTP_MAILER_MAX smtp8 smtp 0
none relay smtp 0
USENET_MAILER_MAX usenet usenet 0
UUCP_MAILER_MAX uucp uucp 100000
UUCP_MAILER_MAX uucp-old uucp 100000
UUCP_MAILER_MAX suucp uucp 100000
UUCP_MAILER_MAX uucp-new uucp 100000
UUCP_MAILER_MAX uucp-dom uucp 100000
UUCP_MAILER_MAX uucp-uudom uucp 100000

To change a maximum size, place your definition before the MAILER command in your mc file. For example, here is one way to increase the limit on UUCP traffic to a more reasonable one million:

define(`UUCP_MAILER_MAX', `1000000')dnl MAILER(`uucp')

To change the limit for agents that lack a definition, copy an existing delivery agent definition, then modify it as outlined in Section 30.3.1 .

30.4.8 N=

How to nice (3) the agent

(V8.7 and above)

The N= equate is used to give a delivery agent a priority in relation to other processes. The mechanism is discussed in the online manual for nice (3).

The form for the N= equate looks like this:

N=

incr

Here, incr is a signed integer expression that will adjust the "niceness" up or down. If incr is zero or missing, the niceness of the delivery agent is unchanged. Positive numbers reduce system priority. Negative numbers increase it.

One possible application for the N= equate might be with Usenet news. Because news seldom needs to flow as quickly as normal email, its delivery agent ( usenet ) can be forced to run at a low system priority:

Musenet, P=/usr/lib/news/inews, F=rlsDFMmn, M=10000, 

N=10,

 A=inews -m -h -n

To change the niceness at the m4 level, copy an existing delivery agent definition and modify it as outlined in Section 30.3.1 .

30.4.9 P=

Path to the delivery agent

(All versions)

The P= equate specifies the full pathname of the program that will act as the delivery agent. The form for the P= equate looks like this:

P=

path

If path is missing, sendmail will print the following error message and set P= to NULL.

mailer 

agent_name

: empty path name

The path can also be one of three names that are defined internally to sendmail . Those internally defined names are [IPC] , which tells sendmail to forward mail over a kernel-supported (usually TCP/IP) network; [FILE] , which tells sendmail to deliver to a file; and [LPC] , which is used for debugging.

P=path

When the path begins with a slash character (when it is a full pathname), sendmail first forks (creates a copy of itself), and then the child process (the copy) execs (replaces itself with) the program. The argument vector ( argv , or command-line arguments) supplied to the program is specified by the A= equate (see Section 30.4.1 ). The program inherits the environment [7] of sendmail and has its standard input and output connected to the parent process (the sendmail that forked). The message (header and body) is fed to the program through its standard input. The envelope (sender and recipient addresses) may or may not be provided on the command line, depending on the nature of the program as defined by its F= flags. If the A= does not include the $u macro, then sendmail will speak SMTP on standard I/O with the program.

[7] In most versions of sendmail the environment is stripped for security. V8 passes only TZ=, AGENT=, and (beginning with V8.7) the environmental variables specified with the E configuration command (see Section 22.2.1, "The E Configuration Command" ).

P=[IPC]

The special internal name [IPC] specifies that sendmail is to make a network connection to the recipient host and that it should talk SMTP to that host. Most current versions of sendmail allow the name [TCP] [8] to be a synonym for [IPC] , but [IPC] should be used when portability is of concern. The $u macro should never be included in the A= for this internal name.

[8] Originally, IPC meant "interprocessor communications," not "interprocess communications" as it does today. Some vendors have made TCP a synonym, thinking that it was more descriptive of the TCP/IP network mechanism. That may be a mistake on their part, because sendmail can interface to other network protocols such as XNS and OSI.

P=[FILE]

Beginning with V8 sendmail , the internal name [FILE] specifies that delivery will be made by appending the message to a file. This name is intended for use by the *file* delivery agent (see Section 30.5, "Internally Defined Names" ). [FILE] can be useful for designing a custom delivery agent whose purpose is to append to files (perhaps coupled with the U= equate, Section 30.4.13 , to force particular ownership of the file).

P=[LPC]

The special internal name [LPC] (for local person communication) causes sendmail to run in a sort of debugging mode. In this mode the mail message is sent to the sendmail program's standard input, and replies are read (in the case of SMTP) from its standard output; you act as the SMTP server.

The [LPC] mode can be very helpful in tracking down mail problems. Consider the mystery of duplicate five-character " From  " header lines that appear at the beginning of a mail message when mail is sent with UUCP. To solve the mystery, make a copy of your sendmail.cf file and change the P= for the UUCP delivery agent to [LPC] in that copy:

Muucp, P=/usr/bin/uux, F=msDFMhuU, S=13, R=23, A=uux - -r $h!rmail ($u)           
-v
           
change to
           
-v
 Muucp, P=[LPC], F=msDFMhuU, S=13, R=23, A=uux - -r $h!rmail ($u)

Then run sendmail by hand to see what it is sending to the uux program:

% 

/usr/lib/sendmail -C



copy.cf uucpaddress



 < 



message

Here, the -C copy.cf command-line argument causes sendmail to use the copy of the sendmail.cf file rather than the original. The uucpaddress is the address of a recipient that would normally be sent via UUCP. The message should contain only a Subject: header line and a minimal body:

Subject: test   
<- one line header
                 
<- a blank line
 This is a test. 
<- one line body

If sendmail prints the message with a five-character " From  " header line at the top, then you know that sendmail is the culprit.

30.4.9.1 m4 modifications of P=

In using V8 sendmail 's m4 configuration technique, the P= equate can be easily changed for all delivery agents by using the definitions in the leftmost column of Table 30.5 .

Table 30.5: m4 Modification of P= Equates
define() Agent MAILER() Default P=
CYRUS_MAILER_PATH cyrus cyrus /usr/cyrus/bin/deliver
CYRUS_MAILER_PATH cyrusbb cyrus /usr/cyrus/bin/deliver
FAX_MAILER_PATH fax fax /usr/local/lib/fax/mailfax
LOCAL_MAILER_PATH local local /bin/mail
LOCAL_SHELL_PATH prog local /bin/sh
MAIL11_MAILER_PATH mail11 mail11 /usr/etc/mail11
PH_MAILER_PATH ph phquery /usr/local/etc/phquery
POP_MAILER_PATH pop pop /usr/lib/mh/spop
PROCMAIL_PATH procmail procmail /usr/local/bin/procmail
none smtp smtp [IPC]
none esmtp smtp [IPC]
none smtp8 smtp [IPC]
none relay smtp [IPC]
USENET_MAILER_PATH usenet usenet /usr/lib/news/inews
UUCP_MAILER_PATH uucp uucp /usr/bin/uux
UUCP_MAILER_PATH uucp-old uucp /usr/bin/uux
UUCP_MAILER_PATH suucp uucp /usr/bin/uux
UUCP_MAILER_PATH uucp-new uucp /usr/bin/uux
UUCP_MAILER_PATH uucp-dom uucp /usr/bin/uux
UUCP_MAILER_PATH uucp-uudom uucp /usr/bin/uux

In general, the default values given to these are automatically set when you include the appropriate OSTYPE() directive (see Section 20.3.1, addheader() ).

30.4.10 R=

Recipient Rewriting Set

(All versions)

The R= equate specifies a rule set to be used for processing all envelope- and header-recipient addresses for a specific delivery agent. Mail messages are always addressed to at least one recipient, but there may be more. The addresses of the recipients are given in the envelope and are usually repeated in the mail message's header. The envelope address is given to sendmail in one of three ways: as a command-line argument; as an SMTP RCPT command; or as To: , Cc: , and Bcc: headers (if the -t command-line switch is given). [9] Figure 30.1 shows how the R= rule set fits into the flow of addresses through rule sets.

[9] The -t switch is intended for initial submissions only.

Figure 30.1: The flow of addresses through rule sets

Figure 30.1

There are two forms for the R= equate. One is the standard form, and the other is an enhanced alternative beginning with V8 sendmail :

R=

ruleset            


<- legal for all
 R=

eset/hset          


<- legal beginning with V8

In the first case, ruleset specifies the rule set to use in rewriting both headers and the envelope. If that value is zero or if the entire R= equate is missing, no rule set is called.

In the second case, two rule sets may be specified. [10] One rule set is specific to the envelope, and the other is specific to headers. The envelope-specific rule set is the one to the left of the slash; the header-specific rule set is to the right ( R=eset/hset ). If both values are missing, both default to zero. If only one is missing, the missing value defaults to the other value.

[10] This form was inspired by an identical form in IDA sendmail .

Either rule set may be specified by using names or numbers or both:

R=Myset                   
<- name
 R=12                      
<- number
 R=Myset=12                
<- both

See Section 29.1, "The S Configuration Command" for a discussion of the various legal ways in which rule sets can be specified.

Macros may not be used in delivery agent rule-set specifications. That is,

R=$X

will not give the expected result. Instead, sendmail will complain about a missing rule-set specification.

When using V8 sendmail 's m4 configuration, you cannot change or specify R= rule sets. If the need arises, however, you can copy an existing delivery agent definition and then modify it as outlined in Section 30.3.1 .

30.4.11 S=

Sender rewriting set

(All versions)

The S= equate specifies a rule set to be used for processing both envelope- and header-sender addresses. The sender's address is given in the envelope and generally repeated in the mail message's From: header line. [11] The envelope address is given to sendmail in one of four ways: as a -f command-line argument, as an SMTP MAIL command, as a From: header, or derived from the identity of the user who ran the program (these latter two are used only during initial message submission). Figure 30.1 shows how the S= rule set fits into the flow of addresses through rule sets.

[11] It is not unusual for these to differ. For example, mail that has been passed through a mailing list exploder may show one address in the envelope and another in the From: header line.

There are two forms for the S= equate. One is the standard form, and the other is an enhanced alternative beginning with V8 sendmail :

S=

ruleset            


<- legal for all
 S=

eset/hset          


<- legal beginning with V8

The first case specifies a rule set ( ruleset ) that will process both recipient and header addresses. If ruleset is zero or if the entire S= equate is missing, no rule set is called.

In the second case, one rule set is specific to the envelope, and the other is specific to headers. The envelope-specific rule is the one to the left of the slash; the header-specific rule is the one to the right ( S=eset/hset ). If both values are both missing, no sender S= processing is done. If only one is missing, the missing value defaults to become the other value. (See Chapter 29, Rule Sets , for a description of possible errors and how the new V8.7 symbolic rule set names can be used.)

Either rule set may be specified using names or numbers or both:

S=Myset                   
<- name
 S=12                      
<- number
 S=Myset=12                
<- both

See Section 29.1 for a discussion of the various legal ways rule sets can be specified.

Macros may not be used in delivery agent rule set specifications. That is,

S=$X

will not give the expected result. Instead, sendmail will complain about a missing rule set specification.

When using V8 sendmail 's m4 configuration, you cannot change or specify S= rule sets. If the need arises, however, you can copy an existing delivery agent definition, then modify it as outlined in Section 30.3.1 .

30.4.12 T=

Types for DSN diagnostics

(V8.7 and above)

Beginning with V8.7 sendmail , notification of successful, deferred, or failed delivery is now determined by Delivery Status Notification (DSN, see RFC1891). The T= equate provides three pieces of required information to DSN. The pieces are separated by the slash character:

T=

mta-type

/

addr-type

/

diag-type

The first piece, the mta-type , is later supplied to the Reporting-MTA: DSN header, as its first argument:

Reporting-MTA: dns; here.us.edu                
-^
                
mta-type here

The second piece, the addr-type , is later supplied to the Final-Recipient: DSN header, as its first argument:

Final-Recipient: rfc822; [email protected]                  
-^
                  
addr-type here

The third piece, the diag-type , is later supplied to the Diagnostic-Code: DSN header, as its first argument:

Diagnostic-Code: smtp; 550 <[email protected]>... User unknown                  
-^
                  
diag-type here

If the P= for a delivery agent is [IPC] or [TCP] , an undeclared mta-type defaults to dns , an undeclared addr-type to rfc822 , and an undeclared diag-type to smtp . For any other P= the default for an undeclared entry is NULL.

In configuring with the m4 technique, the declarations of the T= equates are

T=X-Unix                        
<- cyrus and prog (equivalent to X-Unix/X-Unix/X-Unix)
 T=X-Phone/X-FAX/X-Unix          
<- fax
 T=DNS/RFC822/X-Unix             
<- local, pop, and procmail
 T=DNS/RFC822/SMTP               
<- all SMTP agents
 T=X-Usenet/X-Usenet/X-Unix      
<- Usenet
 T=X-UUCP/X-UUCP/X-Unix          
<- all UUCP agents

You cannot change these T= defaults. If the need arises, you can, however, copy an existing delivery agent definition and then modify it as outlined in Section 30.3.1 .

30.4.13 U=

Run agent as uid:gid

(V8.7 and above)

Prior to V8.7 the user and group identities under which sendmail ran were defined by an elaborate set of properties (described under the F=S flag in Section 30.8.40, F=S ). Beginning with V8.7, sendmail now offers the U= equate as the means to define those identities. If the U= equate is specified, it sets the default user and group identities for the delivery agent and always overrides the values of the DefaultUser ( u ) ( g ) option (see Section 34.8.15, DefaultUser (g)(u) ). If the F=S flag is not set, any controlling user will override this U= equate. If the F=S flag is set, this U= equate is absolute, overriding everything, including any controlling user.

The form of the U= equate looks like this:

U=

user

:

group

The user is the alphanumeric identity of a user on the local system. If user is found in the local passwd (5) file, the numeric uid from that file becomes the value used. Otherwise, user , which must be fully numeric, becomes the value used.

The colon, [12] if present, is followed by the alphanumeric identity of a group on the local system. If the group is found in the local group (5) file, the numeric gid from that file is used. Otherwise, group , which must be fully numeric, becomes the value used. If the colon and group are missing or if the user was found in the passwd (5) file, the value is taken from the gid field of the passwd (5) file.

[12] A colon is used because the POSIX standard allows login names to contain a dot.

In using V8 sendmail 's m4 configuration, no U= equate is specified for any delivery agent. You cannot add a U= equate with the m4 technique. If the need arises, however, you can copy an existing delivery agent definition and then modify it as outlined in Section 30.3, "m4 Configuration Syntax" .


Previous: 30.3 m4 Configuration Syntax sendmail Next: 30.5 Internally Defined Names
30.3 m4 Configuration Syntax Book Index 30.5 Internally Defined Names