作者:白杨树 | 来源:互联网 | 2014-05-28 08:57
Centos/dovecot/LNMP/sendmailCentos6.3已??安?SendMail1.添加SendMail服?沼蛎?im/etc/mail/local-host-names?ⅰ?ourdomainname.com」加至local-host-names文件中一行一??域名2.更改Sendmail的??接
Centos/ dovecot/ LNMP/ sendmail
Centos 6.3 已??安?SendMail
1. 添加SendMail服?沼蛎?br />
vim /etc/mail/local-host-names
?ⅰ?ourdomainname.com」 加至 local-host-names 文件中
一行一??域名
2. 更改Sendmail的??接口
cp sendmail.mc sendmail.mc.bak /?浞菖渲梦募?br />
vim /etc/mail/sendmail.mc
查 找:
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA’)dnl
修改?椋?br />
DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA’)dnl
查 找:
dnl DAEMON_OPTIONS(`Port=submission, Name=MSA, M=Ea’)dnl
修改?椋?br />
DAEMON_OPTIONS(`Port=25, Name=MSA, M=Ea’)dnl
若你的伺服不?可使用25,?更改其他.
3. ???MTP的用?粽J?
vim /etc/mail/sendmail.mc
?ふ遥?br />
dnl TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN’)dnl
dnl define(`confAUTH_MECHANISMS’, `EXTERNAL GSSAPI DIGEST-MD5
CRAM-MD5 LOGIN PLAIN’)dnl
更改:(去掉前面??:「dnl」)
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN’)dnl
define(`confAUTH_MECHANISMS’, `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5
LOGIN PLAIN’)dnl
4. 安?SMTP??saslauthd套件
yum install cyrus-sasl cyrus-sasl-devel cyrus-sasl-plain
cyrus-sasl-md5
5. ?定可以RELAY的?^域
指定?楸?CRELAY ??的部分??褂?MTP??
vi /etc/mail/access
Connect:localhost.localdomain RELAY
Connect:localhost RELAY
Connect:127.0.0.1 RELAY
Connect:yourdomainname.com RELAY
6. 生成sendmail.cf文件
cd /etc/mail
m4 sendmail.mc > sendmail.cf
7. ?作出 hash 格式的?料??br />
cd /etc/mail
makemap hash access.db
8. 用?艄芾碇噶?br />
groupadd mailuser /* 建立?件用?艚M*/
useradd -g mailuser -s /sbin/nologin mike /*建立不能登?系?的?件用??/
vim /etc/aliases /*sendmail使用aliases?C制????件?e名和群?功能*/
admin: maxwell /*admin是maxwell的?e名*/
testgroup: mike,john,tom,jack /*?件群?,向testgroup?箱?送就是向4??人?送*/
newaliases /*??liases.db???旄??/
9. 安?dovecot(POP3,IMAP)
yum install dovecot
vim /etc/dovecot/dovecot.conf
查找:#protocols = imap pop3 lmtp
更改:protocols = imap pop3 lmtp
10. ?定dovecot使用的???C制
vi /etc/sysconfig/saslauthd
?ふ遥?ECH=pam
改?椋?ECH=shadow
11. ?置在系?3和5??e?? 及重??br />
chkconfig ?level 35 sendmail on
chkconfig ?level 35 saslauthd on
chkconfig ?level 35 dovecot on
service dovecot restart
service saslauthd restart
service sendmail restart
注意事?:
若??Dovecot不能正常使用?K在maillog中出了????息:
user towns: Initialization failed: mail_location not set and
autodetection failed: Mail storage autodetection failed with
home=/home/towns
Error: Invalid user settings. Refer to server log for more
information.
vim /etc/dovecot/conf.d/10-mail.conf
找到?K修改下行,?]找到就自己加上去,注意/var/spool/mail/?段,?改成自己系?的
mail_location = mbox:~/mail:INBOX=/var/spool/mail/%u
问题1: 日志出现tried to use disabled plaintext auth
outlook登陆不进
/etc/dovecot/conf.d目录下有一个10-mail.conf的文件。内容如下:
# mail_location = maildir:~/Maildir
mail_location = mbox:~/mail:INBOX=/var/mail/%u
# mail_location =
mbox:/var/mail/%d/%1n/%n:INDEX=/var/indexes/%d/%1n/%n
disable_plaintext_auth=no
ssl_disable = no
取消注释,并添加你的文件中或许没有的内容。
#vi /etc/dovecot/dovecot.conf
取消注释protocols = imap pop3 lmtp
我的是dovecot-2.1.1-2_132.el5,修改方法如下:
vi
/etc/dovecot/conf.d/10-auth.conf去掉disable_plaintext_auth前面#,修改为disable_plaintext_auth
= no
vi /etc/dovecot/conf.d/10-ssl.conf修改为ssl = no重启dovecot服务,OK
service dovecot restart
问题二 错误日志:
rhel6 dovecot: pop3(forsaken): Couldn’t open INBOX
解决如下:
Dec 21 16:56:41 rhel6 dovecot: pop3(forsaken): Couldn’t open
INBOX top=0/0, retr=0/0, del=0/0, size=0
[root@rhel6 ~]# su ? forsaken
[forsaken@rhel6 ~]$ mkdir -p /home/forsaken/mail/.imap/INBOX
为了使新创建的用户可以自动创建这个目录,可以修改/etc/skel/.bash_profile文件如下
[root@rhel6 ~]# vi /etc/skel/.bash_profile
添加如下内容
if [ ! -d ~/mail/.imap/INBOX ];then
mkdir -p ~/mail/.imap/INBOX
fi
重新启动服务或服务器