Sendmail configuration in Linux environment (2)

  




5. Install Sendmail
The latest version of Sendmail can be obtained from ftp://ftp. It is available at sendmail.org/pub/sendmail/. In addition, many linux distributions include the Sendmail package. For details, please visit the Sendmail homepage at http://www.sendmail.org.
First log in to the system as root, unpack the tar.gz package tar -xzf sendmail.8.9.3.tar.gz, start compiling with make -f. After the compilation, the system setup file - sendmail.cf is generated.

Six, Sendmail configuration file
At this time, the installed Sendmail is almost useless, you must set its configuration file sendmail.cf, it can work properly. The format of this file is discussed in detail below.

1. Each line of the format
file starts with a command character, followed by the specific settings. The command character describes the role of the line. The setting content describes the set object, and the blank line will be ignored. If the first character of the line is a space, it is the continuation line of the previous line.

2. Command character function description
The command character of each line determines the role of the line. The following describes the command characters in the configuration file one by one.
(1) #
## indicates that this line is a comment line.
(2) D
D is the macro definition operator, the usage is: DK [string], which defines the macro K as the following string, which can be referenced in the configuration file, avoiding more Enter one of the same strings at a time. Note: The name of the macro should be a single uppercase letter, because Sendmail defines its own macro variables in lowercase letters.
(3) C and F
C and F are class definition operators, usage is: CK [class name] or FK file name, which defines the class K or defines the class K from the specified file. Value. A class can contain one or more words, as well as separate uppercase letters for the same reason.
(4) H
H is the header definition operator. Generally speaking, we do not need to do any repairs to the headers provided by default in the configuration file.
(5) O
O is the setting option operator, sendmail has a variety of options that can be set for its operation, and can also be used to tell sendmail where to use the file. Of course, these options can also be provided through the command line. The two methods are equivalent. People often set the settings that are rarely changed in the configuration file by the O operator.
(6) P
P is the priority operator used to specify the priority level of the mail. In addition, sendmail also specifies some specific message headers, and these specific message headers have a certain priority. For example:
Pspecial-delivery = 100
Pfirst-class = 0
Plist = -30
Pjunk = -100
(7) V
V is the version level operator of sendmail.cf It enables sendmail to know which features can be found in the configuration file. It should be noted that the version level of sendmail.cf and the version level of sendmail are not the same thing.
(8) K
K is a keyword database operator because sendmail uses some keyword databases, such as alias libraries and so on. The K operator can be used to tell sendmail the location or category of the available databases. The default support for DBM format libraries can generally support DBM, BTREE, HASH, NIS, etc.
(9) M
M is the operator of the mail sender. For each target, a special mail sender can be defined. The mail sender will send the mail to other hosts via the fixed SMTP transporter defined by sendmail.
All mail senders are defined by a line starting with the M operator and the name of the mail sender, for example:
Mlocal, P=/bin/mail, F=lsDFMfSn, S=10, R= 20, A=mail-d $ u
In the definition of the local mail sender above, the P operation item is used to provide the path name of the location where the program for delivering the mail is located, and F is used to provide the send mail for the local mail sender. Sign. The following S and A items specify the rule set used by sendmail to rewrite the sender and recipient addresses. For example, S=11/21 means that the sender's envelope address is rewritten with rule set 11 and the number 21 is used. The rule set is used to override the sender's header address. The A item is used to provide the command line for the program being run, here /bin/mail, so sendmail will run the command: mail –d $u, where the macro $u will be replaced by the user of the user whose mail should be sent. name. <10> (10) S and R
S and R are rule set operators. The rule set is used to find errors in the address, rewrite the address to a form that the remote mail sender can understand, and parse the mail into the internal mail. A mail sender. Sendmail will transfer addresses to the rule set in a fixed order, and the rule set can also call other rule sets. The rule set is specified by S, followed by the number used to represent the rule set.

Seven, some documents about sendmail
There will be many files in sendmail, here are a few commonly used meanings:
1/var/log/maillog sendmail log, analysis error Useful
2/var/spool/mail/$USER incoming letter, one file per user
3/var/spool/mqueue mail queue, you can use mailq to see the pending message in the queue
4 /etc/sendmail.cw If the machine has a lot of aliases, write the name in this file, so that you can receive a letter by writing



Copyright © Windows knowledge All Rights Reserved