mail服务器原理
mail服务器搭建
本域通信;跨域通信。
serverX:
//配置wode.com域的dns服务器
//配置abc.com域的dns服务器
#vim /etc/named.conf
zone "abc.com" IN {
type master;
file "abc";
};
#cd /var/named
#cp named.localhost abc
#chgrp named abc
#vim abc
$TTL 1D
@ IN SOA dns.abc.com. root.abc.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
@ IN NS dns.abc.com.
dns IN A 172.25.0.11
@ IN MX 5 mail.abc.com.
mail IN A 172.25.0.10
www IN A 172.25.0.10
#systemctl restart named.service
#systemctl stop firewalld.service
//修改主机名
#vim /etc/hostname
mail.wode.com
默认装postfix软件
软件postfix主配置文件:
#vim /etc/postfix/main.cf //修改5处
myhostname = mail.wode.com //主机名
mydomain = wode.com //本域
myorigin = $mydomain //默认补全@后本域
inet_interfaces = all //监听所有端口
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,mail.$mydomain
//决定域内域外;
#systemctl restart postfix.service
-----
远程接受软件pop3协议,端口110
#yum -y install dovecot
主配置文件
#vim /etc/dovecot/dovecot.conf
protocols = imap pop3 lmtp //开启;
login_trusted_networks = 0.0.0.0/0
dict {
} //自己添加
子配置文件
#vim /etc/dovecot/conf.d/10-auth.conf
(默认注释)#disable_plaintext_auth = yes
#vim /etc/dovecot/conf.d/10-ssl.conf
ssl = no
#vim /etc/dovecot/conf.d/10-mail.conf
mail_location = mbox:~/mail:INBOX=/var/mail/%u
(默认开启)mbox_write_locks = fcntl
#su - yonghu
#mkdir -p mail/.imap/INBOX
#systemctl start dovecot
desktopX:
#vim /etc/resolv.conf
nameserver 172.25.X.11
#nslookup
>mail.wode.com
>set type=mx
>wode.com
#mail -s aaaaa wode@wode.com
#mail -s ooooooo -r xidada@wode.com wode@wode.com
#vim /etc/postfix/main.cf
myhostname = mail.abc.com
mydomain = abc.com
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,mail.$mydomain
#systemctl restart postfix.service
#systemctl stop firewalld.service
#yum -y install dovecot
#vim /etc/dovecot/dovecot.conf
protocols = imap pop3 lmtp
login_trusted_networks = 0.0.0.0/0
dict {
}
#vim /etc/dovecot/conf.d/10-auth.conf
#disable_plaintext_auth = yes
#vim /etc/dovecot/conf.d/10-ssl.conf
ssl = no
#vim /etc/dovecot/conf.d/10-mail.conf
mail_location = mbox:~/mail:INBOX=/var/mail/%u
mbox_write_locks = fcntl
#su - aaa
#mkdir -p mail/.imap/INBOX
#systemctl restart dovecot.service
#yum -y install telnet
#telnet mail.wode.com 25(smtp远程发送端口)
helo mail.wode.com
mail from:xxxxxxx
rcpt to:wode@wode.com
data
subject:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
.
quit
#telent mail.wode.com 110(pop3远程接受端口)
user wode
pass 123
list
retr //查看
Quit
# yum -y install postfix
# vim /etc/postfix/main.cf
要求:
1、这些系统不接受外部发送来的邮件
2、从这些系统上发送的邮件显示来自于 example.com
3、在这些系统上本地发送的任何邮件都会自动路由到mail.example.com
**您可以通过发送邮件到本地用户’dave’来测试您的配置.
#yum -y install postfix
#vim /etc/postfix/main.cf
mynetworks = 127.0.0.0/8
relayhost=[mail.example.com]
myorigin = example.com
#systemctl restart postfix.service
#systemctl enable postfix.service
#mail -s "test" dave