搭建postfix邮件服务器
来源:互联网 发布:网络插座安装 编辑:程序博客网 时间:2024/04/29 03:41
需要安装的软件包:postfix
环境为:redhat 6.1 32bit
主配置文件 /etc/postfix/main.cf
运行参数配置/etc/postfix/master.cf
访问控制文件 /etc/postfix/access
别名数据库文件/etc/aliases
虚拟别名域库文件/etc/postfix/virtual
具体过程如下:
[root@localhost etc]# cd /var/named/chroot/var/named/[root@localhost named]# ls1.zone data named.ca named.localhost slaveschroot dynamic named.empty named.loopback[root@localhost named]# vim 1.zone#先修改DNS域名服务器,使之能够解析邮件服务器地址$TTL 1D@ IN SOA example.com. root. ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum NS chen@ MX 10 mail#@ 指在本域内,即example.com,MX为邮件服务器解析,10优先级,mail为邮件服务器的hostnamemail A 192.169.1.100#解析到自己example.com. A 192.169.1.100station1 A 192.169.1.100www A 192.169.1.100chen A 192.169.1.100ftp CNAME www[root@localhost named]# service named restart停止 named:..^C[root@localhost named]# ps aux|grep namedroot 6205 0.0 0.0 103244 860 pts/12 S+ 11:04 0:00 grep namednamed 30927 0.0 2.9 235964 30508 ? Ssl 01:36 0:05 /usr/sbin/named -u named -t /var/named/chroot[root@localhost named]# kill -9 30927[root@localhost named]# service named start启动 named: [确定][root@localhost named]# nslookup www.example.comServer:192.169.1.100Address:192.169.1.100#53Name:www.example.comAddress: 192.169.1.100[root@localhost named]# nslookup mail.example.com#可以正常解析Server:192.169.1.100Address:192.169.1.100#53Name:mail.example.comAddress: 192.169.1.100[root@localhost named]# hostnamelocalhost.localdomain[root@localhost named]# hostname mail.example.com#修改hostname[root@localhost named]# vim /etc/sysconfig/network#写入配置文件NETWORKING=yesHOSTNAME=mail.example.com[root@localhost named]# yum -y install postfix#安装postfix包Loaded plugins: refresh-packagekit, rhnpluginThis system is not registered with RHN.RHN support will be disabled.Setting up Install ProcessResolving Dependencies--> Running transaction check---> Package postfix.i686 2:2.6.6-2.2.el6_1 set to be updated--> Finished Dependency ResolutionDependencies Resolved================================================================================ Package Arch Version Repository Size================================================================================Updating: postfix i686 2:2.6.6-2.2.el6_1 rhel-source 2.0 MTransaction Summary================================================================================Install 0 Package(s)Upgrade 1 Package(s)Total download size: 2.0 MDownloading Packages:Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning 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]# lsaccess generic main.cf relocated virtualcanonical 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 user1uid=502(user1) gid=502(user1) 组=502(user1)[root@localhost postfix]# mail user1Subject: hello user1nihaoEOT[root@localhost postfix]# su - user1[user1@mail ~]$ mailHeirloom 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"& 1Message 1:From root@example.com Mon Aug 13 11:14:57 2012Return-Path: <root@example.com>X-Original-To: user1Delivered-To: user1@example.comDate: Mon, 13 Aug 2012 11:14:57 +0800To: user1@example.comSubject: hello user1User-Agent: Heirloom mailx 12.4 7/29/08Content-Type: text/plain; charset=us-asciiFrom: root@example.com (root)Status: Rnihao& quitHeld 1 message in /var/spool/mail/user1[user1@mail ~]$ ------------------群发,指定别名-------------------[root@localhost postfix]# pwd/etc/postfix[root@localhost postfix]# lsaccess generic main.cf relocated virtualcanonical header_checks master.cf transport[root@localhost postfix]# vim main.cf #指定别名数据库,第386和397行要打开,指定别名数据库385 #alias_maps = dbm:/etc/aliases386 alias_maps = hash:/etc/aliases387 #alias_maps = hash:/etc/aliases, nis:mail.aliases388 #alias_maps = netinfo:/aliases389 390 # The alias_database parameter specifies the alias database(s) that391 # are built with "newaliases" or "sendmail -bi". This is a separate392 # configuration parameter, because alias_maps (see above) may specify393 # tables that are not necessarily all under control by Postfix.394 #395 #alias_database = dbm:/etc/aliases396 #alias_database = dbm:/etc/mail/aliases397 alias_database = hash:/etc/aliases398 #alias_database = hash:/etc/aliases, hash:/opt/majordomo/aliases[root@localhost postfix]# vim /etc/aliasesYou have new mail in /var/spool/mail/root 92 # trap decode to catch security attacks 93 decode: root 94 jinpeng.chen: user1, user2#增加这行,jinpeng.chen为其他所有用户到别名 95 # Person who should get root's mail 96 #root: marc[root@localhost postfix]# newaliases#刷新别名数据库[root@localhost postfix]# mail jinpeng.chenSubject: qunfahello,everyone....EOT[root@localhost postfix]# su - user1[user1@mail ~]$ mailHeirloom Mail version 12.4 7/29/08. Type ? for help."/var/spool/mail/user1": 2 messages 1 new 1 root Mon Aug 13 11:14 19/562 "hello user1">N 2 root Mon Aug 13 11:35 18/578 "qunfa"& 2Message 2:From root@example.com Mon Aug 13 11:35:36 2012Return-Path: <root@example.com>X-Original-To: jinpeng.chenDelivered-To: jinpeng.chen@example.comDate: Mon, 13 Aug 2012 11:35:36 +0800To: jinpeng.chen@example.comSubject: qunfaUser-Agent: Heirloom mailx 12.4 7/29/08Content-Type: text/plain; charset=us-asciiFrom: root@example.com (root)Status: Rhello,everyone...& quitHeld 2 messages in /var/spool/mail/user1[user1@mail ~]$ exitlogout[root@localhost postfix]# su - user2[user2@mail ~]$ mailHeirloom Mail version 12.4 7/29/08. Type ? for help."/var/spool/mail/user2": 1 message 1 new>N 1 root Mon Aug 13 11:35 18/578 "qunfa"& 1Message 1:From root@example.com Mon Aug 13 11:35:37 2012Return-Path: <root@example.com>X-Original-To: jinpeng.chenDelivered-To: jinpeng.chen@example.comDate: Mon, 13 Aug 2012 11:35:36 +0800To: jinpeng.chen@example.comSubject: qunfaUser-Agent: Heirloom mailx 12.4 7/29/08Content-Type: text/plain; charset=us-asciiFrom: root@example.com (root)Status: Rhello,everyone...& quitHeld 1 message in /var/spool/mail/user2[user2@mail ~]$
- 搭建postfix邮件服务器
- Postfix搭建邮件服务器
- postfix邮件服务器搭建
- postfix邮件服务器搭建
- postfix邮件服务器搭建
- POSTFIX邮件服务器搭建
- linux 邮件服务器搭建-postfix
- Postfix公网邮件服务器搭建
- Postfix,dovecot邮件服务器搭建
- Linux--搭建postfix邮件服务器
- 搭建 Postfix、Dovecot 邮件服务器
- postfix邮件服务器搭建笔记
- CentOS 搭建postfix邮件服务器
- postfix+ dovecot搭建邮件服务器
- postfix+cyrus-imapd搭建邮件服务器
- ubuntu下用postfix搭建邮件服务器
- ubuntu 下postfix邮件服务器的搭建
- linux+postfix+openwebmail+sasl搭建邮件服务器
- SSH框架学习语录一:学习Struts,先从Servlet编程开始
- 本科学材料,读研学CS找工作总结,强烈推荐!
- STL map 和 hash_map
- 新鬼影病毒
- Android Training - 使用碎片创建一个动态UI(4) - 与其他碎片通信
- 搭建postfix邮件服务器
- VideoNet的程序 调试过程
- dedeCMS中的责任编译的修改方法
- JAVA基础知识
- hdu 4323 Magic Number
- android “attempt to write a readonly database”出错解决
- dedeCMS中的几点总结
- Android Intent 传递对象
- wxWidgets 的编译和使用