首先setup命令看看sendmaildovecotsaslauth三个服务是不是都开机启动,确保开机启动1.确认安装包(系统默认会安装上的)rpm-qa|grepsendmail出来提示:sendmail-8.13.4-2如果没有提示,则没有安装,则安装相应的rpm包2.启动sendmail首先:ps-ef|
首先setup命令看看sendmail dovecot saslauth
三个服务是不是都开机启动,确保开机启动
1.确认安装包(系统默认会安装上的)
rpm -qa |grep sendmail
出来提示:
sendmail-8.13.4-2
如果没有提示,则没有安装,则安装相应的rpm包
2.启动sendmail
首先:ps -ef |grep sendmail
查看有没有启动进程:
[root@cinemachoiceServer sysconfig]# ps -ef |grep sendmail
root 14130 1
0 16:27 ? 00:00:00
sendmail: accepting connections
smmsp 14136 1 0
16:27 ? 00:00:00
sendmail: Queue runner@01:00:00 for /var/spool/clientmqueue
root 14222 12273 0 16:32
pts/0 00:00:00 grep sendmail
如果没有则首先启动:
1。直接service sendmail start就行
2。或者先find / -name sendmail 可以找到sendmail的路径:
/var/lock/subsys/sendmail
/etc/rc.d/init.d/sendmail
/etc/sysconfig/sendmail
/usr/lib/sendmail
/usr/sbin/sendmail
/usr/share/logwatch/scripts/services/sendmail
运行/usr/sbin/sendmail start即可
3.修改监听地址(我的地址是192.168.1.251)
这一步通过下面步骤6来完成
find / -name sendmail.cf
出来:/etc/mail/sendmail.cf
然后修改sendmail.cf中的这么一行:
dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1,
Name=MTA')dnl
改成
DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl
再重启sendmail
service sendmail restart
4.测试开通25(
iptables)
首先确保防火墙打开了25端口。
[root@cinemachoiceServer sysconfig]# netstat -nlp |grep
sendmail
tcp
0 0
192.168.1.251:25
0.0.0.0:*
LISTEN 14130/sendmail: acc
可以看到25端口打开了
telnet 192.168.1.251
25出来下面信息表示sendmail已经在正常监听了。
[root@cinemachoiceServer sysconfig]# telnet 192.168.1.251 25
Trying 192.168.1.251...
Connected to 192.168.1.251 (192.168.1.251).
Escape character is '^]'.
220 localhost.localdomain ESMTP Sendmail 8.13.4/8.13.4; Tue, 11 Apr
2006 16:47:36 +0800
相反下面的信息表示要不sendmail没有启动,要不的3部中没有修改好,要不防火墙没有打开25端口
Trying 192.168.1.251...
telnet: connect to address 192.168.1.251: Connection refused
telnet: Unable to connect to remote host: Connection refused
5.启动pop3
看安装dovecot没有(对应imap-2002d-2.i386.rpm)
rpm -qa dovecot
如果没有提示,则手动安装
service dovecot restart
然后netstat -tl
看看是不是在listen110端口
[root@cinemachoiceServer mail]# netstat -tl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local
Address
Foreign
Address
State
tcp
0 0
*:cvspserver
*:*
LISTEN
tcp
0 0
*:43908
*:*
LISTEN
tcp
0 0
*:
mysql
*:*
LISTEN
tcp
0 0
*:sunrpc
*:*
LISTEN
tcp
0 0
*:ftp
*:*
LISTEN
tcp
0 0
localhost.localdomain:ipp
*:*
LISTEN
tcp
0 0 localhost.localdomain:5335
*:*
LISTEN
tcp
0 0
192.168.1.251:smtp
*:*
LISTEN
tcp
0 0
*:imaps
*:*
LISTEN
tcp
0 0
*:pop3s
*:*
LISTEN
tcp
0 0
*:pop3
*:*
LISTEN
tcp
0 0
*:imap
*:*
LISTEN
tcp
0 0
*:http
*:*
LISTEN
tcp
0 0
*:ssh
*:*
LISTEN
tcp
0 0
*:https
*:*
LISTEN
6.认证
cp /etc/mail/sendmail.mc /etc/mail/sendmail.mc.bak
vi /etc/mail/sendmail.mc
48行
dnl TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN
PLAIN')dnl
49行
dnl define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5
CRAM-MD5 LOGIN PLAIN')dnl
#?h掉??尚星懊娴 dnl,注意:TRUST_AUTH_METH、define前面不要留有空格(vi ?h掉字:x)
105行
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
修改成-->
DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl
cp /etc/mail/sendmail.cf /etc/mail/sendmail.cf.bak
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
vi /etc/mail/access
原来的保持,增加
192.168.0.0
RELAY
/////李武军注释:这儿0代表的是网络名,网段。
makemap hash /etc/mail/access.db
/etc/rc.d/init.d/saslauthd start
/etc/rc.d/init.d/sendmail start
chkconfig saslauthd on
chkconfig sendmail on
或者:
service saslauthd restart
service sendmail restart
service dovecot
restart
//不开则foxmail收信显示“网络忙”
然后
telnet 192.168.1.251 25
输入
ehlo lcoal
结果如下
250-localhost.localdomain Hello mail.test.com [192.168.1.251],
pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5 LOGIN PLAIN
250-DELIVERBY
250 HELP
注:认证方式
特别注意查看auth中是否有LOGIN PLAIN,不然总不能登陆。
如果没有使用plain 登陆,验证失败
可以从:
ps -ef|grep sasl
=>root 18721
1 0 09:47 ?
00:00:00 /usr/sbin/saslauthd -m /var/run/saslauthd -a shadow
看出来认证方式是shadow.
如果要修改对应:
/usr/lib/sasl2/Sendmail.conf
内容:
pwcheck_method:saslauthd
///默认就是
/etc/rc.d/init.d/saslauthd
MECH=sasldb(默认是shadow)
/etc/sysconfig/saslauthd
MECH=sasldb(默认是shadow)
7.其他问题
邮件过滤与反垃圾
需要安装插件,
http://anti-spam.org.cn/可以参考