Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Deploy the mail system using postfix and dovecot-- learn notes

2025-03-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

The experimental environment is redhat 7.0system.

As shown in the above figure

The client uses outlook to send and receive mail

The server uses postfix to send mail, and dovecot to receive mail and forward the changed user.

1. Install dns Domain name Resolution Service 1.1 configure server host name Need to ensure that the server host name and outgoing domain name are consistent [root@localhost Desktop] # vim / etc/hostname mail.wifiin.com [root@localhost Desktop] # hostnamemail.wifiin.com1.2 clear the default policy of the iptables firewall [root@localhost Desktop] # iptables-F [root@localhost Desktop] # service iptables saveiptables: Saving firewall rules to / etc/sysconfig/iptables: [OK] 1.3 configure the dns service # install [root@localhost Desktop] # yum install Bind-chroot-y # modify the configuration [root@localhost Desktop] # vim / etc/named.conf options {listen-on port 53 {any }; [change to any] listen-on-v6 port 53 {:: 1;}; directory "/ var/named"; dump-file "/ var/named/data/cache_dump.db"; statistics-file "/ var/named/data/named_stats.txt"; memstatistics-file "/ var/named/data/named_mem_stats.txt"; allow-query {any;} [change it to any] # add the zone information of wifiin.com to the end of the file [root@localhost Desktop] # vim / etc/named.rfc1912.zones zone "wifiin.com" IN {type master; file "wifiin.com.zone"; allow-update {none;};} # enter the named regional profile directory / var/named [root@localhost log] # cd / var/named/ [root@localhost named] # cp-a named.localhost wifiin.com.zone [root@localhost named] # vim wifiin.com.zone$TTL 1D @ IN SOA wifiin.com. Root.wifiin.com. (0; serial 1D; refresh 1H; retry 1W; expire 3H) Minimum NS ns.wifiin.com.ns IN A 192.168.137.10 @ IN MX 10 mail.wifiin.com.mail IN A 192.168.137.101.4 start the dns service # start the service and set the boot self-boot [root@localhost named] # systemctl restart named [root@localhost named] # systemctl enable namedln-s'/ usr/lib/systemd/system/named.service''/ etc/systemd/system/multi-user.target.wants/named.service '# modify the server's dns to native ip [root@localhost named] # vim / etc/resolv.conf nameserver 192.168.137.102. Configure postfix Service 2.1 install [root@localhost ~] # yum install postfix-y2.2 modify configuration file

The main configuration file is / etc/postfix/main.cf, and several parameters need to be modified:

# modify the variable of myhostname, and the user saves the host name of the server myhostname = mail.wifiin.com# to modify the variable of mydomain, which is used to save the name of the mail domain mydomain = wifiin.com# to modify the variable of myorigin, which is used to save the name of the domain name that sent the email. Call the variable of mydomain to modify the service listening address with myorigin = $mydomain# Which IP addresses provide email service inet_interfaces = all# modify the host name or domain name list that can accept mail mydestination = $myhostname, $mydomain2.3 create the login user of the email system This user is the user of the server's local system [root@localhost ~] # useradd developer [root@localhost ~] # echo "redhat" | passwd-- stdin developerChanging password for user developer.passwd: all authentication tokens updated successfully. [root@localhost ~] # systemctl restart postfix [root@localhost ~] # systemctl enable postfix3 configuration dovecot Service 3.1 install [root@localhost ~] # yum install dovecot-y3.2 modify configuration

The main configuration file / etc/dovecot/dovecot.conf, modify the parameters:

# modify the supported e-mail protocol protocols = imap pop3 lmtp# to allow users to use clear text for password authentication because my lab environment does not have a certificate. You need to write to the configuration file disable_plaintext_auth = no# to set the network segment allowed to log in login_trusted_networks = 192.168.137.0lap24

Configuration file / etc/dovecot/conf.d/10-mail.conf, modify the following parameters:

# configure email format and storage path mail_location = mbox:~/mail:INBOX=/var/mail/%u # switch to developer user Create a directory to save messages in the home directory [root@localhost ~] # su-developer [developer@mail ~] $mkdir-p mail/.imap/INBOX [developer@mail ~] $exit# launch service [root@localhost ~] # systemctl restart dovecot [root@localhost ~] # systemctl enable dovecotln-s'/ usr/lib/systemd/system/dovecot.service''/ etc/systemd/system/multi-user.target.wants/dovecot.service'

4. The test windows test machine must be in the same network segment as the server side. The windows test machine must modify the dns to the server side dns address. Use windows's outlook to log in to the developer@wifiin.com mailbox, send e-mail to the root@wifiin.com user, log in to the server to see if the root user can receive the mail sent by the developer user. Use the root user on the server to send mail to developer@wifin.com. Check whether developer users on the outlook of windows can receive messages sent by root

The email sent by the developer user is shown below:

Messages received by developer users, as shown below:

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report