您的位置:首页 > 运维架构 > Linux

postfix和dovecot简单的邮件服务器

2015-06-08 20:05 489 查看
[align=center]postfix和dovecot简单的邮件服务器
[/align]

一、安装postfix和dovecot

yum install postfix  

yum install dovecot

二、postfix邮件服务器的配置

vim /etc/postfix/main.cf

myhostname = mail.ning.com

mydomain = ning.com

myorigin = $mydomain

inet_interfaces = all

inet_protocols = all

mydestination = $mydomain

mynetworks = 0.0.0.0/0

relay_domains = $mydestination

home_mailbox = Maildir/

service postfix restart

把 inet_interfaces = localhost 注释掉

三、用telnet测试邮件服务器是否正常

1. 在邮件服务器上安装telnet

yum install telnet

2. 连接服务器SMTP端口

telnet 192.168.1.22 25

3. 填写发件人

MAIL FROM:<test@cning.com>

回车

4. 填写收件人

RCPT TO:contact@ning.com

回车

5. 撰写邮件内容

5.1 开始写邮件内容

DATA

回车

5.2 输入标题

Subject: test message

回车

5.3 输入内容,并以.号结束

test body .

如果显示下面的信息,说明邮件进入发送队列

250 2.0.0 Ok: queued as 88D6D32A94

四、配置dovecot 收取邮件

vim /etc/dovecot/dovecot.conf

protocols = imap pop3 lmtp

listen = *, ::

login_trusted_networks =0.0.0.0/0

vim /etc/dovecot/conf.d/10-mail.conf

mail_location = maildir:~/Maildir #只定邮箱路径

vim /etc/dovecot/conf.d/10-auth.conf

auth_mechanisms = plain login    #允许验证和登录

disable_plaintext_auth = yes     #允许明文登录

vim /etc/dovecot/conf.d/10-master.conf

unix_listener auth-userdb {     #允许运行的数据库

    #mode = 0600

    user =postfix

    group =postfix

  }

 service dovecot restart

五、测试

新建用户 useradd aaa -p 521521

mail aaa@ning.com

 

接受端可用foxmail测试

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息