vi /etc/selinux/config
将SELINUX=enforce改成SELINUX=disabled,需要重新启动计算机生效;
vi /etc/sysconfig/saslauthd
将MECH=pam改成MECH=shadow;
service saslauthd start #启动saslauthd
chkconfig saslauthd on #设置saslauthd开机自动启动
testsaslauthd -u username -p password
如果显示0: OK “Success.”则表明saslauthd工作正常;
yum install sendmail-cf
vi /etc/mail/sendmail.mc
删除下边两行开头的dnl:
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN’)dnl
define(`confAUTH_MECHANISMS’,`EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN’)dnl
#配置支持的认证方式,配置后通过验证的用户都可以发邮件,不用在access里配置Relay
DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA’)dnl #修改侦听范围
DAEMON_OPTIONS(`Port=587,Name=MSA,M=a')dnl #增加通过587端口发邮件
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf #生成配置
vi /etc/mail/local-host-names
添加域名如: an.test //每个域名一行
service sendmail restart
chkconfig sendmail on
telnet smtp_server 25
HELO domainname
250 domainname Hello [10.57.28.221], pleased to meet you
AUTH LOGIN
#输入这个后,使用base64编码的用户名密码,使用下面一句话来生成
perl -MMIME::Base64 -e ‘print encode_base64(“word”)’
334 VXNlcm5hbWU6
dGVzdA== # base64编码后的test
334 UGFzc3dvcmQ6
YWJjZC4xMjM0 #base64编码后的abcd.1234
235 2.0.0 OK Authenticated
MAIL FROM:[email protected]
250 2.1.0 [email protected]… Sender ok
RCPT TO:[email protected]
250 2.1.5 [email protected]… Recipient ok
DATA # 开始邮件的内容
Subject:test #邮件标题
This a test email. #邮件正文
. #用一个.结束邮件
yum install dovecot
vi /etc/dovecot.conf
去掉以下几行前边的#并修改;
protocols = imap pop3
disable_plaintext_auth = no
mail_location = mbox:/var/mail:INBOX=/var/mail/%u
service dovecot start
chkconfig dovecot on
telnet pop3_server 110
auth
user user_name
pass user_password
#验证OK以后就可以使用pop3模式收发邮件了;