Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2912686
  • 博文数量: 454
  • 博客积分: 4860
  • 博客等级: 上校
  • 技术积分: 6375
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-13 10:08
个人简介

10年工作经验,专研网站运维。

文章分类

全部博文(454)

文章存档

2017年(11)

2016年(13)

2015年(47)

2014年(36)

2013年(147)

2012年(64)

2011年(136)

分类: 系统运维

2016-11-23 14:33:51

[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


  1. [root@localhost named]# yum -y install postfix      #安装postfix包  
  2. Loaded plugins: refresh-packagekit, rhnplugin  
  3. This system is not registered with RHN.  
  4. RHN support will be disabled.  
  5. Setting up Install Process  
  6. Resolving Dependencies  
  7. --> Running transaction check  
  8. ---> Package postfix.i686 2:2.6.6-2.2.el6_1 set to be updated  
  9. --> Finished Dependency Resolution  
  10.   
  11. Dependencies Resolved  
  12.   
  13. ================================================================================  
  14.  Package        Arch        Version                    Repository          Size  
  15. ================================================================================  
  16. Updating:  
  17.  postfix        i686        2:2.6.6-2.2.el6_1          rhel-source        2.0 M  
  18.   
  19. Transaction Summary  
  20. ================================================================================  
  21. Install       0 Package(s)  
  22. Upgrade       1 Package(s)  
  23.   
  24. Total download size: 2.0 M  
  25. Downloading Packages:  
  26. Running rpm_check_debug  
  27. Running Transaction Test  
  28. Transaction Test Succeeded  
  29. Running Transaction  
  30.   Updating       : 2:postfix-2.6.6-2.2.el6_1.i686                           1/2   
  31.   Cleanup        : 2:postfix-2.6.6-2.el6.i686                               2/2   
  32.   
  33. Updated:  
  34.   postfix.i686 2:2.6.6-2.2.el6_1                                                  
  35.   
  36. Complete!  
  37. [root@localhost named]# cd /etc/postfix/  
  38. [root@localhost postfix]# ls  
  39. access     generic        main.cf    relocated  virtual  
  40. canonical  header_checks  master.cf  transport  
  41. [root@localhost postfix]# vim main.cf       #修改主配置文件  
  42.   
  43.   
  44. #主要配置如下几个地方  
  45. myhostname = mail.example.com       #本机主机名  
  46. mydomain = example.com          #域名  
  47. myorigin = $mydomain            #设置由本机寄出去的邮件所使用的域名或主机名  
  48. inet_interfaces = all           #postfix所监听的网络  
  49. mydestination = $myhostname, localhost.$mydomain, localhost, example.com    #设置可接受邮件的主机名和域名  
  50. mynetworks = 192.169.1.0/24     #设置在什么网络内收发邮件  
  51. relay_domains = $mydestination      #设置在什么网域内收发邮件  
  52.   
  53.   
  54. [root@localhost postfix]# service postfix restart  
  55. 关闭 postfix:                                             [确定]  
  56. 启动 postfix:                                             [确定]  
  57. [root@localhost postfix]# id user1  
  58. uid=502(user1) gid=502(user1) 组=502(user1)  
  59. [root@localhost postfix]# mail user1  
  60. Subject: hello user1  
  61. nihao  
  62. EOT  
  63. [root@localhost postfix]# su - user1  
  64. [user1@mail ~]$ mail  
  65. Heirloom Mail version 12.4 7/29/08.  Type ? for help.  
  66. "/var/spool/mail/user1": 1 message 1 new  
  67. >N  1 root                  Mon Aug 13 11:14  18/551   "hello user1"  
  68. & 1  
  69. Message  1:  
  70. From root@example.com  Mon Aug 13 11:14:57 2012  
  71. Return-Path:   
  72. X-Original-To: user1  
  73. Delivered-To: user1@example.com  
  74. Date: Mon, 13 Aug 2012 11:14:57 +0800  
  75. To: user1@example.com  
  76. Subject: hello user1  
  77. User-Agent: Heirloom mailx 12.4 7/29/08  
  78. Content-Type: text/plain; charset=us-ascii  
  79. From: root@example.com (root)  
  80. Status: R  
  81.   
  82. nihao  
  83.   
  84. & quit  
  85. Held 1 message in /var/spool/mail/user1  
  86. [user1@mail ~]$   
阅读(3431) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~