手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

RHEL6.0 简单(SMTP)邮件服务器搭建

[日期:2012-05-20] 来源:Linux社区  作者:who7708 [字体:大 中 小]

重启服务

/etc/init.d/postfix restart

/etc/init.d/dovecot restart

mydestination指定mail server接收的邮件的域,必须是以***@example.com结尾的邮件接收,其余的全部拒绝接收(注意红的字体部分的域)

编辑/etc/postfix/main.cf文件通过postconf -e ##=$$,$$部分指定的内容将会覆盖或是改变文件里面##原有的内容

client host在192.168.0.6主机上配置
yum install postifx -y

编辑文件/etc/postfix/main.cf

postconf -e inet_interfaces = localhost

postconf -e myorigin = example.com

postconf -e “local_transport = error:local delivery disabled ”

postconf -e relayhost = smtp.example.com

重启服务  /etc/init.d/postfix restart

smtp server在192.168.0.7主机上配置

yum install postfix -y


编辑文件/etc/postfix/main.cf

postconf -e inet_interfaces = all

postconf -e myorigin = example.com

postconf -e “local_transport = error:local delivery disabled”

重启服务 /etc/inti.d/postfix restart

开始收发邮件的测试

在client(server6)主机发送邮件,假设mail server有一个hazeline用户

client发送邮件:mail hazeline

[root@client ~]# mail hazeline

Subject: hello

helloworld

helloworld

EOT ----> ctrl+d


root@server6 ~]# tail /var/log/maillog

Mar 23 23:51:38 server6 postfix/pickup[2338]: 7FA85424D2: uid=0 from=<root>

Mar 23 23:51:38 server6 postfix/cleanup[2377]: 7FA85424D2: messageid=<20120323155138.7FA85424D2@server6.example.com>

Mar 23 23:51:38 server6 postfix/qmgr[2069]: 7FA85424D2: from=<root@example.com>, size=450, nrcpt=1 (queue active)

Mar 23 23:51:48 server6 postfix/smtp[2380]: 7FA85424D2: to=<hazeline@example.com>, orig_to=<hazeline>, relay=smtp.example.com[192.168.0.7]:25, delay=10, delays=0.12/0.02/10/0.18, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as D230C402C9)

Mar 23 23:51:48 server6 postfix/qmgr[2069]: 7FA85424D2: removed


在mail server(server5)

查收hazeline的邮件

[root@server5 ~]# cat /var/spool/mail/hazeline

From root@example.com Wed Mar 21 05:42:01 2012

Return-Path: <root@example.com>

X-Original-To: hazeline@example.com

Delivered-To: hazeline@example.com

Received: from server7.example.com (unknown [192.168.0.7])

              by server5.example.com (Postfix) with ESMTP id 30C2241CD5

               for <hazeline@example.com>; Wed, 21 Mar 2012 05:42:01 +0800 (CST)

Received: from server6.example.com (unknown [192.168.0.6])

               by server7.example.com (Postfix) with ESMTP id 27CE8402C9

               for <hazeline@example.com>; Wed, 21 Mar 2012 05:40:40 +0800 (CST)

Received: by server6.example.com (Postfix, from userid 0)

               id D087E424D2; Fri, 23 Mar 2012 23:42:03 +0800 (CST)

Date: Fri, 23 Mar 2012 23:42:03 +0800

To: hazeline@example.com ----> 接收邮件的用户

Subject: hello ----> 邮件标题

User-Agent: Heirloom mailx 12.4 7/29/08

MIME-Version: 1.0

Content-Type: text/plain; charset=us-ascii

Content-Transfer-Encoding: 7bit

Message-Id: <20120323154203.D087E424D2@server6.example.com>

From: root@example.com (root)

helloworld

helloworld ----> 邮件内容

linux
相关资讯       RHEL6 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款