Webmail邮件服务器搭建-有问题-邮件发出去,对方收不到
来源:互联网 发布:阿里云四大件 编辑:程序博客网 时间:2024/05/02 04:44
#搭建WebMail邮件服务器#1.关闭系统默认安装的 sendmail:[root@red4 ~]# service sendmail stop关闭 sendmail: [失败][root@red4 ~]#[root@red4 ~]# chkconfig --level 35 sendmail off[root@red4 ~]#[root@red4 ~]# chkconfig --list sendmailsendmail 0:关闭 1:关闭 2:关闭 3:关闭 4:关闭 5:关闭 6:关闭[root@red4 ~]##2.安装提供邮件服务的软件包[root@red4 ~]# yum list | grep postfixThis system is not registered with RHN.RHN support will be disabled.postfix.i386 2:2.3.3-2.1.el5_2 rhel5 postfix-pflogsumm.i386 2:2.3.3-2.1.el5_2 rhel5 [root@red4 ~]# yum install -y postfix#3.修改配置文件[root@red4 ~]# cd /etc/postfix/[root@red4 postfix]# lsaccess generic main.cf master.cf post-install transportbounce.cf.default header_checks main.cf.default postfix-files relocated virtualcanonical LICENSE makedefs.out postfix-script TLS_LICENSE[root@red4 ~]# vim main.cf 1 myhostname = mail.163.com 2 mydomain = 163.com 3 myorigin = $mydomain 4 inet_interfaces = 192.168.101.104,127.0.0.1 5 mydestination = $myhostname,$mydomain 6 home_mailbox = Maildir/#4.启动服务[root@red4 postfix]# service postfix start启动 postfix: [确定][root@red4 postfix]##5.查看服务的进程名和监听的端口#注意:这里查找的是<master>[root@red4 postfix]# netstat -utnap | grep mastertcp 0 0 192.168.101.104:25 0.0.0.0:* LISTEN 13370/master tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 13370/master [root@red4 postfix]##6.Postfix 使用本地系统账号作为邮件账号<passwd=111>[root@red4 postfix]# useradd userone[root@red4 postfix]# passwd useroneChanging password for user userone.New UNIX password: BAD PASSWORD: it is WAY too shortRetype new UNIX password: passwd: all authentication tokens updated successfully.[root@red4 postfix]# useradd usertwo[root@red4 postfix]# passwd usertwoChanging password for user usertwo.New UNIX password: BAD PASSWORD: it is WAY too shortRetype new UNIX password: passwd: all authentication tokens updated successfully.[root@red4 postfix]##7.安装提供收邮件服务的软件包#注意:如果提示依赖错误,需要安装<mysql>和<perl>[root@red4 postfix]# yum list | grep dovecotThis system is not registered with RHN.RHN support will be disabled.dovecot.i386 1.0.7-7.el5 rhel5 [root@red4 postfix]# yum install -y dovecot#8.修改dovecot的配置文件[root@red4 postfix]# cat /etc/dovecot.conf | grep "mail_location = maildir:~/Maildir"# mail_location = maildir:~/Maildir[root@red4 postfix]# cat /etc/dovecot.conf | grep protocols#protocols = imap imaps pop3 pop3s[root@red4 postfix]##9.启动服务\查看端口[root@red4 postfix]# service dovecot start启动 Dovecot Imap: [确定][root@red4 postfix]# netstat -utnap | grep dovecottcp 0 0 :::993 :::* LISTEN 13537/dovecot tcp 0 0 :::995 :::* LISTEN 13537/dovecot tcp 0 0 :::110 :::* LISTEN 13537/dovecot tcp 0 0 :::143 :::* LISTEN 13537/dovecot [root@red4 postfix]# #10.安装WEB客户端程序#注意:可能会提示PHP依赖,需要安装<php-mbstring>[root@red4 postfix]# yum list | grep squirrelmailThis system is not registered with RHN.RHN support will be disabled.squirrelmail.noarch 1.4.8-5.el5_4.10 rhel5 [root@red4 postfix]# yum install -y squirrelmail#11.开启HTTPD服务[root@red4 postfix]# service httpd restart停止 httpd: [确定]启动 httpd: [确定][root@red4 postfix]# #修改squirrelmail支持语言[root@red4 postfix]# vim /etc/squirrelmail/config.php#26 $squirrelmail_default_language = 'zh_CN';#59 $default_charset = 'UTF-8';#12.打开浏览器测试#注意:打开失败后,检查您的DNS配置,看看是否正确.#使用刚才创建的<userone><usertwo>用户登录.http://www.wing.com/webmail/src/login.php###############################################问题###############################################Q1.不能使用<root>用户登录不知道为什么?#Q2.可以登录,使用<userone>登录后,给<usertwo@mail.wing.com>发邮件#<usertwo>接收不到,为什么?###############################################邮件系统DNS配置###############################################1修改named.conf[root@red4 etc]# pwd/var/named/chroot/etc[root@red4 etc]# cat named.conf options{ directory "/var/named";}; zone "wing.com" IN { type master; file "wing.com.zone"; }; zone "101.168.192.in-addr.arpa." IN { type master; file "mail.com.arpa"; }; #2.创建wing.com.zone[root@red4 named]# pwd/var/named/chroot/var/named[root@red4 named]# cat wing.com.zone $TTL 7200wing.com. IN SOA dns.wing.com. root.wing.com. ( 20130606 1H 15M 1W 1D ) IN NS dns.wing.com.dns.wing.com. IN A 192.168.101.104mail.wing.com. IN A 192.168.101.104wing.com. IN MX 10 mail.wing.com.#3.测试[root@red4 named]# host mail.wing.commail.wing.com has address 192.168.101.104[root@red4 named]# host dns.wing.comdns.wing.com has address 192.168.101.104[root@red4 named]# [root@red4 named]# host -t PTR 192.168.101.104104.101.168.192.in-addr.arpa domain name pointer dns.wing.com.104.101.168.192.in-addr.arpa domain name pointer mail.wing.com.[root@red4 named]# [root@red4 named]# nslookup > set type=mx> wing.comServer: 127.0.0.1Address: 127.0.0.1#53 wing.com mail exchanger = 10 mail.wing.com.> > set type=ptr> 192.168.101.104Server: 127.0.0.1Address: 127.0.0.1#53 104.101.168.192.in-addr.arpa name = mail.wing.com.104.101.168.192.in-addr.arpa name = dns.wing.com.> > set type=a> mail.wing.comServer: 127.0.0.1Address: 127.0.0.1#53 Name: mail.wing.comAddress: 192.168.101.104>