Sendmail Software Package. preparation of i386sendmail-cf.i386sendmail-devel.i386sendmail-doc.i386m4dovecot (pop3 server) procmail configuration before: 1, synchronization time 2, set the host name # vim/etc/hosts192.168.0.249 station249.example.com configuration Directory:/etc/mailsendmail. mcsendmail. cflocal-host-namesaccess Example 1: The simplest mail system only allows the local machine to send emails to the Local Machine [root @ station249 mail] # telnet 127.0.0.1 25 Trying 127.0.0.1... connected to localhost. localdomain (127.0.0.1 ). escape character is '^] '. 220 station249.example.com ESMTP Sendmail 8.13.8/8.13.8; Sun, 12 Sep 2010 22:58:14 + 0800 helo moto250 station249.example.com Hello localhost. localdomain [127.0.0.1], pleased to meet youmail from: root@station249.example.com250 2.1.0 root@station249.example.com... sender okrcpt to: user1@station249.example.com250 2.1.5 user1@station249.example.com... recipient okdata354 Enter mail, end ". "on A line by itselfThis is contentsEnd.250 2.0.0 o8CEwEIE014102 Message accepted for deliveryquit221 2.0.0 station249.example.com closing connectionConnection closed by foreign host. check whether user1 has received the email # cat/var/mail/user1 Example 2: allow other machines to connect to send the email (all users who receive the email are on the email server) Note: the current "other machines" can only be users in the same domain or in the same network segment # vim/etc/mail/sendmail. mc DAEMON_OPTIONS ('port = smtp, Addr = 0.0.0.0, Name = MTA ') dnl # m4/etc/mail/sendmail. mc>/etc /Mail/sendmail. cf # service sendmail restart iptables setting # iptables-a input-p tcp -- dport 25-j ACCEPT # iptables-a input-p udp -- dport 25-j ACCEPT Example 3: allow logon from the local machine and other IP addresses to send emails. The email can be a solution for other domains: enable smtp authentication 1. Enable smtp authentication configuration DAEMON_OPTIONS ('port = submission, Name = MSA, M = Ea ') dnlTRUST_AUTH_MECH ('external DIGEST-MD5 login plain ') dnldefine ('confauth _ MECHANISMS ', 'external GSSAPI DIGEST-MD5 LO Gin plain ') dnl # m4/etc/mail/sendmail. mc>/etc/mail/sendmail. cf 2. install and verify the supported software package # yum install cyrus-sasl *-y 3. restart related services # service sendmail restart # service saslauthd restart # service dovecot restart # chkconfig... on verification whether smtp verification is supported [root @ php rhce_env] # telnet 192.168.0.249 25 Trying 192.168.0.249... connected to station249.example.com (192.168.0.249 ). escape character is '^]'. 220 station249.example. co M ESMTP Sendmail 8.13.8/8.13.8; Sun, 12 Sep 2010 23:20:30 + 0800 ehlo station249.example.com # -----250-station249.example.com Hello station254.example.com [192.168.0.254], pleased to meet you250-ENHANCEDSTATUSCODES250-PIPELINING250-8BITMIME250-SIZE250-DSN250-ETRN250-AUTH GSSAPI DIGEST-MD5 CRAM-MD5 login plain # ---- see AUTH keyword 250-DELIVERBY250 HELP Example 4: only allow users in the Local Machine and example.com domain to log on and send external mail questions. The intention is to request users of a certain IP address Enable the relay function. What is relay? That is, emails can be sent to other domains # vim/etc/mail/accessConnect: 127.0.0.1 RELAY <--- there is no Connect: example.com RELAY <--- add a line # makemap hash/etc/mail/access. db </etc/mail/access Example 5: support for short domain name # vim/etc/mail/local-host-namesstation249.example.comexample.com Example 6: Set pop3s, imaps Software Package dovecot service dovecot in general, dovecot service only supports pop3 (110), imap (143) protocol # mutt-f pop: // user1@station249.example.com set pop3s (995), imaps (993 )# Vim/etc/dovecot. confprotocols = imap imaps pop3 pop3s ssl_cert_file =/etc/pki/tls/certs/localhost. crtssl_key_file =/etc/pki/tls/private/localhost. keyssl_key_password = 123456 generate the key file: # cd/etc/pki/tls/certs/# make localhost. key <--- enter the password # mkke localhost. crt # cp localhost. key .. /private/# service dovecot restart iptables set iptables-a input-p tcp-m multiport -- dports 110,143,993,995-j ACCEPTipt Ables-a input-p udp-m multiport -- dports 110,143,993,995-j ACCEPT verification # mutt-f pops: // The user1@station249.example.com limit only allows users in the example.com domain to receive mail using pop3/imap and so on. First, determine which network segment of example.com is iptables-a input-p tcp-s 192.168.0.0/24-m multiport -- dports 110,143,993,995-j ACCEPTiptables-a input-p udp-s 192.168.0.0/24-m multiport -- dports 110,143,993,995-j ACCEPT