First, the basic knowledge:
SendMail is the most widely used message transfer agent in a UNIX environment, SendMail mail server features powerful but complex configuration, sendmail version upgrades very frequently, The SendMail version number used by the host can be judged by telnet to the host's Port 25th. For example:
Telnet xxx.xxx.xxx.xxx 25
xxx.xxx.xxx.xxx ESMTP Sendmail 8.12.1/8.12.1; Thu AUG 2002 10:33:21 0800 (EAT)
The above information indicates that the host is running sendmail8.12.1. The version number is generally composed of three digits separated by two dots. The vast majority of current operations are SendMail 8.x.x. If you are on a sendmail server, you can run sendmail–d0.4 to view the version, for example: Version aix4.3/8.12.1
SendMail to start, stop, and refresh, you can use the following command:
Startsrc–s SendMail, can also take parameters: Startsrc–s sendmail-a "-bd-q30m"
Stopsrc–s SendMail
Refresh–s SendMail
To view the status of SendMail:
Lssrc–s SendMail
Configure Boot auto Start SendMail
Edit/etc/rc.tcpip, find Start/usr/lib/sendmail this line, if it is commented out, uncomment, find and set QPI parameters, the default is 30 minutes, that is, qpi=30m (s for seconds, M for minutes, h for hours, d for days, W stands for the week). M is the default.
Manual start sendmail such as:
sendmail–q15m
The parameter values at the back of the-Q are QPI.
SendMail is a daemon (daemon), an information routing program that SendMail records the activity of the messaging system through SYSLOGD daemon. To be able to do this,/etc/syslog.conf must include the following lines:
Mail.debug/var/spool/mqueue/log
If/var/spool/mqueue/log does not exist, Touch/var/spool/mqueue/log
And then start Syslogd:refresh–s syslogd.
The Message Queue directory is/var/spool/mqueue, and the contents of the message queue can be printed by MAILQ or SENDMAIL–BP. Message queues contain four types of message queue files: Data files, control files, temporary files, and Codex files. The format of the file is as follows:
dfAA00312 Data files
qfAA00312 Control File
tfAA00312 Temporary files
xfAA00312 Transcript Document
Show statistics for messages:
Touch/var/tmp/sendmail.st, this file must be established before mailstats can be used to view statistics.
Use mail alias and forwarding:
The definition of aliases is placed in the/etc/aliases file, with an example of adding an alias manager and adding one line to the/etc/aliases:
Manager:caddy,zhang,joan@xxx.com
Then create an owner for the alias, and if SendMail sends an incorrect message to the alias, it sends an error message to the owner.
Add one line to the/etc/aliases:
owner-manager:mars@xxx.com.cn
Recompile the/etc/aliases with newaliases or SENDMAIL–BI, and then restart Sendmail,mail Manager to send the message to caddy,zhang,joan@xxx.com.
You can use/etc/aliases to forward messages, or you can use $home/.forward.
Examples of using/etc/aliases:
Tom:zhang, joan@xxx.com
In this way, Tom can not receive any mail, mail to Zhang, joan@xxx.com, if Tom also want to receive, the last line to make the following changes:
Tom:\tom,zhang, joan@xxx.com
Automatically delete Tom's messages:
Tom:/dev/null
Examples of using $home/.forward:
Edit the. Forward file in the home directory of the user (suppose Tom) as follows:
Zhang, joan@xxx.com
If Tom also wants to receive it, the previous line makes the following changes:
\tom,zhang, joan@xxx.com
Automatically delete Tom's messages:
/dev/null
The modification of the $home/.forward will take effect immediately, unlike the/etc/aliases, which needs to be recompiled.
Send mail to Local Users: Mail Tom
Send mail to other host users of this network: Mail john@mars Mars as host name
Send mail to Internet mailbox users: Mail joan@xxx.com
Use BNU or UUCP to send mail: Mail @InternetSystem: Uucpsystem!username
Storage of messages:
The system mailbox is the/var/spool/mail directory, once the user reads automatically saves in the $home/mbox directory, if is interrupted in the generation mail process, will these incomplete information deposit in the $home/dead.letter.
Second, configure SendMail to send Internet mail through an SMTP server:
In the TCP/IP network, the common three kinds of host name resolution methods are: DNS, NIS, etc/hosts, if the/etc/resolv.conf exists first DNS resolution, if you want to change the order of parsing, you can modify/etc/netsvc.conf or variable Nsorder (whose precedence is higher than/etc/netsvc.conf), such as hosts=local,nis,bind can be defined in/etc/netsvc.conf, or you can set Nsorder=local,nis
1. The situation with DNS
SendMail The default settings work with DNS, you do not need to make any changes to the/ETC/SENDMAIL.CF, set up a/etc/resolv.conf and connect to the DNS server, you can send Internet mail.
2. Using the SMTP proxy
The full name of SMTP is the Simple Mail Transfer Protocol, which is responsible for exchanging messages between two servers or clients. Customarily, if the source server/client sends the message over the SMTP protocol to its target server, we call it "post" or "Relay" (RELAY)
The SMTP service has several notable features:
1.SMTP Service is anonymous service, does not require to confirm the sender and the recipient's true identity;
The 2.SMTP service is a plaintext service in which all SMTP-transmitted content is transmitted in clear text.
With the SMTP proxy, you need to make some modifications to the/ETC/SENDMAIL.CF, which is the host that is configured to forward the message, to modify the DS entry first. The format is as follows:
SMTP Host Definition: DS
Host name for DSSMTP XX.COM.CNÀSMTP
Or
IP address of the DSSMTP:[XXX.XXX.XXX.XXX]ÀSMTP
Definition of this machine: Dw, DM and CW
The Sendmail default automatically defines the DW (the hostname of this machine), the Dm (domain name), and the Cw (host alias). The format is as follows:
DWXXX//Host name is written next to DW
dmcom.cn
Cwlocalhost
After the SendMail service is configured, you can then use sendmail–d0.4 to view the status of the domain name and sendmail version, and send the message with MAIL–V to display the detailed sending information.
such as: Mail–v test@xxx.com
The information displayed is as follows:
Test@xxx.com.cn ... Connecting to [xxx.xxx.xxx.xxx] via SMTP ...
xxx.com ESMTP
>>> EHLO xxx.com.cn//Sender's name is: User name @ xxx.com.cn
250-xxx.com.cn
250-auth LOGIN cram-md5 PLAIN
250-auth=login CRAM-MD5 PLAIN
250-pipelining
8BITMIME
>>> MAIL from:< username @xxx.com.cn>
Ok
>>> RCPT to:
Ok
>>> DATA
354 Go ahead
>>>. à Terminator < carriage return >< line break >.< enter >< line break >
QP OK 1024473751 1714
Test@xxx.com.cn ... Sent (ok 1024473751 qp 1714)
Closing connection to [xxx.xxx.xxx.xxx]
>>> QUIT
221 xxx.com.cn
Where the contents of >>> can be manually entered, you can telnet xxx.xxx.xxx.xxx (SMTP proxy host name) 25, step by step input, test the entire mail delivery process, to find the cause of the failure. please contact the site, timely note your name. Contact Email: edu#chinaz.com (change # to @).