[root@post-test ~]# hostname
postfix-server
[root@postfix-server ~]# rpm -qa |grep sendmail
[root@postfix-server ~]# yum remove sendmail -y
[root@postfix-server ~]# alternatives --config mta
选择如下2:
There are 2 programs which provide 'mta'.
Selection Command
-----------------------------------------------
*+ 1 /usr/sbin/sendmail.ssmtp
2 /usr/sbin/sendmail.postfix
-
[root@localhost named]# yum -y install postfix #安装postfix包
-
Loaded plugins: refresh-packagekit, rhnplugin
-
This system is not registered with RHN.
-
RHN support will be disabled.
-
Setting up Install Process
-
Resolving Dependencies
-
--> Running transaction check
-
---> Package postfix.i686 2:2.6.6-2.2.el6_1 set to be updated
-
--> Finished Dependency Resolution
-
-
Dependencies Resolved
-
-
================================================================================
-
Package Arch Version Repository Size
-
================================================================================
-
Updating:
-
postfix i686 2:2.6.6-2.2.el6_1 rhel-source 2.0 M
-
-
Transaction Summary
-
================================================================================
-
Install 0 Package(s)
-
Upgrade 1 Package(s)
-
-
Total download size: 2.0 M
-
Downloading Packages:
-
Running rpm_check_debug
-
Running Transaction Test
-
Transaction Test Succeeded
-
Running Transaction
-
Updating : 2:postfix-2.6.6-2.2.el6_1.i686 1/2
-
Cleanup : 2:postfix-2.6.6-2.el6.i686 2/2
-
-
Updated:
-
postfix.i686 2:2.6.6-2.2.el6_1
-
-
Complete!
-
[root@localhost named]# cd /etc/postfix/
-
[root@localhost postfix]# ls
-
access generic main.cf relocated virtual
-
canonical header_checks master.cf transport
-
[root@localhost postfix]# vim main.cf #修改主配置文件
-
-
-
#主要配置如下几个地方
-
myhostname = mail.example.com #本机主机名
-
mydomain = example.com #域名
-
myorigin = $mydomain #设置由本机寄出去的邮件所使用的域名或主机名
-
inet_interfaces = all #postfix所监听的网络
-
mydestination = $myhostname, localhost.$mydomain, localhost, example.com #设置可接受邮件的主机名和域名
-
mynetworks = 192.169.1.0/24 #设置在什么网络内收发邮件
-
relay_domains = $mydestination #设置在什么网域内收发邮件
-
-
-
[root@localhost postfix]# service postfix restart
-
关闭 postfix: [确定]
-
启动 postfix: [确定]
-
[root@localhost postfix]# id user1
-
uid=502(user1) gid=502(user1) 组=502(user1)
-
[root@localhost postfix]# mail user1
-
Subject: hello user1
-
nihao
-
EOT
-
[root@localhost postfix]# su - user1
-
[user1@mail ~]$ mail
-
Heirloom Mail version 12.4 7/29/08. Type ? for help.
-
"/var/spool/mail/user1": 1 message 1 new
-
>N 1 root Mon Aug 13 11:14 18/551 "hello user1"
-
& 1
-
Message 1:
-
From root@example.com Mon Aug 13 11:14:57 2012
-
Return-Path:
-
X-Original-To: user1
-
Delivered-To: user1@example.com
-
Date: Mon, 13 Aug 2012 11:14:57 +0800
-
To: user1@example.com
-
Subject: hello user1
-
User-Agent: Heirloom mailx 12.4 7/29/08
-
Content-Type: text/plain; charset=us-ascii
-
From: root@example.com (root)
-
Status: R
-
-
nihao
-
-
& quit
-
Held 1 message in /var/spool/mail/user1
-
[user1@mail ~]$
阅读(3484) | 评论(0) | 转发(0) |