Postfix and Devecot Sending and receiving mail
The Mail Application protocol includes:
a Simple Mail Transfer Protocol ( SMTP): Used to send or relay e-mail,port:
Third edition Post Office Protocol ( POP3): Used to store messages on the server to the local host,port:
Fourth edition Internet Information Access Protocol ( IMAP4), which is used to access Mail on localhost,port:143
The e-mail system consists of three parts:
User Agent MUA: For sending and receiving mail
Mail Transfer Agent MTA: Forward messages from MUA to a specified user
Mail Delivery Agent MDA: Saving messages from the MTA to your native inbox
e-mail systems are fundamentally different from most network application protocols:
FTP Service: Both communication must be online at the same time, otherwise it will error the connection timeout
e-mail system: If the other party's server down, will temporarily store the message locally, detected the other side of the server to complete the delivery
Enterprise-Class E-mail:
Anti-spam anti-virus module: prevent spam or virus messages from interfering with corporate mailboxes
Message encryption: Ensure message content is not sniffed, tampered with
e-Mail monitoring audit: monitor all staff in the e-mail messages are not sensitive words, disclose enterprise information, etc.
Stability: Good resistance to DDOS attack capability to ensure system reliability
Deploying a basic e-mail system requires:
Postfix: Mail Send (SMTP)
Dovecot: Mail acceptance (POP3)
Outlook: Client mail sending and receiving
Simulation Experiment:
Environment :
DNS Server |
Rhel7 |
IP:192.168.200.102 |
Mail server |
Rhel7 |
IP:192.168.200.103 |
Client |
Windows 7 |
IP:192.168.200.200 |
DNS server configuration:
[Email protected] ~]# yum-y install bind bind-Chroot[[email protected]~]# vim/etc/named.conf//Modify the Listening port IP on line 11Listen-on Port -{192.168.200.102; };//Modify the 17 row to allow the queried host to be any Allow-query {any;}; [[Email protected]~]# vim/etc/Named.rfc1912.zoneszone"linuxs.com"In {type master; File"Linuxs.com.zone"; allow-update {none;};}; [[Email protected]~]# CD/var/named/[email protected] named]# CP-a named.localhost linuxs.com.zone[[email protected] named]# vim Linuxs.com.zone$ttl 1d@ in SOA linuxs.com. Linu Xs.com. (0; serial 1D; Refresh 1H ; Retry 1W; Expire 3H); Minimum NS ns1.linuxs.com.@ in MXTenmail.linuxs.com.ns1 A192.168.200.102Mail A192.168.200.103[[email protected] named]# systemctl restart Named[[email protected] named]# systemctl enable NAMEDLN-S'/usr/lib/systemd/system/named.service' '/etc/systemd/system/multi-user.target.wants/named.service'
To configure the mail server:
" mail.linuxs.com " >/etc/~~]# yum-y install postfix dovecot
the configuration file for the Postfix Post Office service program is as follows:
File |
Role |
/usr/sbin/postfix |
Main Service Program |
/etc/postfix/master.cf |
configuration file for master main program |
/etc/postfix/main.cf |
configuration files for postfix services |
/var/log/maillog |
Logging the message delivery process |
to view The main configuration file for the Postfix service program:
[Email protected] ~]# CAT/ETC/POSTFIX/MAIN.CF
Parameters |
Role |
Myhostname |
Host name of the Post Office system |
MyDomain |
The domain name of the Post Office system |
Myorigin |
The domain name of the message sent from this computer |
Inet_interfaces |
Nic Interface for monitoring |
Mydestination |
Host name or domain name that can receive mail |
Mynetworks |
Set up messages for which hosts can be forwarded |
Relay_domains |
Set which domains can be forwarded for mail |
To modify the parameters of the Postfix master configuration file:
[Email protected] ~]# vim/etc/postfix/main.cf//Modify the postoffice host name on line 76thMyhostname=mail.linuxs.com//Modify the Post office domain name on line 83rdmydomain=linuxs.com//Modify the outgoing mail domain name for line 99th ($mydomain already defined in 83 rows)Myorigin=$mydomain//Modify the Listening network card on line 116thinet_interfaces= All//Modify the host name and domain name of the incoming message on line 164thmydestination=$myhostname, $mydomain
Create a Post office account :
[Email protected] ~"123.com" | passwd--stdin Boss
To start the postfix program:
[Email protected] ~~]# systemctl enable Postfix
To modify the Dovecot program master configuration file:
[Email protected] ~]# vim/etc/dovecot/dovecot.conf// Modify the Post Office Protocol on Line 24th (and append allow clear text authentication)= = no// Modify line 48th allows login to the network segment address (all allowed for 0.0.0.0/0)192.168. 200.0/
To configure the format and storage path for messages:
[[email protected] ~]# vim/etc/dovecot/conf.d/-mail.conf// Remove The 25-line Comment = mbox:~/mail:inbox=/var/mail/%u
To create a storage directory for the message:
[email protected] ~]# Su-~]$ mkdir-p Mail/.imap/inbox
To start the Dovecot program:
[Email protected] ~~'/usr/lib/systemd/system/dovecot.service' /etc/systemd/system/multi-user.target.wants/dovecot.service'
Windows7 Outlook Verification :
Root user received mail:
To set up a user alias mailbox:
[Email protected] ~]# vim/etc/aliasesxxoo: ~]# newaliases
Verify:
Root user received mail:
linux[Basic]-35-[Post Office System]-[postfix and DOVECOT]-[01]