Chinaunix首页 | 论坛 | 博客
  • 博客访问: 19736643
  • 博文数量: 679
  • 博客积分: 10495
  • 博客等级: 上将
  • 技术积分: 9308
  • 用 户 组: 普通用户
  • 注册时间: 2006-07-18 10:51
文章分类

全部博文(679)

文章存档

2012年(5)

2011年(38)

2010年(86)

2009年(145)

2008年(170)

2007年(165)

2006年(89)

分类: LINUX

2006-11-24 16:42:18

redhat9上面搭建最简单的postfix邮件系统:

确认系统中没有sendmail系统

安装软件包:

[root@NTP_50_18 meil]# rpm -ivh postfix-1.1.11-11.i386.rpm

warning: postfix-1.1.11-11.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e

\Preparing...                ########################################### [100%]

   1:postfix                ########################################### [100%]

[root@NTP_50_18 meil]# rpm -ivh imap-2001a-18.i386.rpm

warning: imap-2001a-18.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e

Preparing...                ########################################### [100%]

   1:imap                   ########################################### [100%]

配置: /etc/postfix/main.cf

采用默认配置, 需要注意的地方如下:

mydestination = $myhostname, localhost.$mydomain

mynetworks_style = subnet

mynetworks = 10.0.0.1/8, 127.0.0.0/8, 172.0.0.1/8

 

注意主机名最好是域名形式的,否则有可能无法启动.

 

配置pop3

 

RedHat7.0已经使用xinetd代替了以前的inetd,为了使pop3服务启动,我们编辑/etc/xinetd.d/ipop3文件,将其中的disable = yes改为disable = no 以便启动pop3服务。

为了使改动生效,执行以下命令:

/etc/rc.d/init.d/xinetd reload

 

postfix

执行以下命令启动postfix:

/etc/rc.d/init.d/postfix start

 

 

以后可能有用的资料:

 

 

详细的比较好的资料:

 

postfix邮件服务器快速指南

 

这个网址还有其他很多相关的文档

 

 

需求:

使用postfix为公司配置一部邮件服务器,用户可以使用username@test.comusername@test.net访问邮箱(也即要实现虚拟域功能),并且要能将所有发给root的邮件转发给用户tom(也即要实现别名)。公司内部网段为192.168.1.0/24,邮件服务器插有两张网卡。

 

一、运行环境:

操作系统:RedHat7.0

postfix版本:postfix-20010228release-2.i386

pop3服务器版本:RedHat7.0自带的imap-4.7c2-12

客户端工具:outlook

 

二、安装postfiximap

 

1 获取postfixrpm软件包。

~sjmudd/postfix/ 站点下载下面的postfixrpm包:

postfix-20010228release-2.i386.rpm

 

2 用以下命令查看系统是否安装了sendmail:

[root@mail /root]# rpm –qa |grep sendmail

sendmail-8.11.0-8

 

3 卸载sendmail

[root@mail /root]# rpm -e sendmail -–nodeps

 

4 用以下命令杀死运行中的sendmail进程:

[root@mail /root]# killall sendmail

如果系统提示:

sendmail: no process killed

则说明当前系统中没有sendmail进程。

 

5 安装postfix

[root@mail /root]# rpm -Uvh postfix-20010228release-2.i386.rpm

 

6 安装imap

插入RedHat7.0安装盘,mount后执行:

rpm –ivh /mnt/cdrom/RedHat/RPMS/ imap-4.7c2-12.rpm

 

三、配置DNS

 

配置DNS服务器,将test.comtest.net域的MX记录都指向邮件服务器,然后执行ndc reload命令使改动生效。

 

四、配置postfix

编辑postfix的主要配置文件/etc/postfix/main.cf,根据需求只需修改以下几个参数:

 

1 mydomain

指明你的域名,在这里我们指定:

mydomain = test.com

 

2 myorigin

myorigin参数指明发件人所在的域名。如果你的用户的邮件地址为user@domain.com,则该参数指定@后面的域名。在这里我们指定:

myorigin = $mydomain

 

3 mydestination

mydestination参数指定postfix接收邮件时收件人的域名,换句话说,也就是你的postfix

系统要接收什么样的邮件。通常与myorigin一样:

mydestination = $mydomain

 

4 mynetworks_style

设置网络类型,我们指定:

mynetworks_style = subnet

 

6mynetworks

定义可以使用的此smtp服务器发信的客户ip地址,因为公司的ip范围已知,所以我们指定:

mynetworks = 192.168.1.0/24

 

五、配置虚拟域

 

为了让用户可以使用username@test.net收发邮件,我们必须配置虚拟域,在main.cf文件中,我们添加以下内容:

virtual_maps = hash:/etc/postfix/virtual

这里假定用户tomtestwhite需要使用这个虚拟域名,当然首先要在系统中添加这几个用户,然后建立/etc/postfix/virtual文件并添加以下内容:

test.net anything

tom@test.net tom

test@test.net test

white@test.net white

之后,用postmap命令生成虚拟域数据库:

postmap /etc/postfix/virtual

 

六、配置用户别名

 

假设tom是管理员,并且通过tom可以收取所有寄给root的邮件,以便管理员对系统进行监控。要实现这一点,我们必须使用邮件别名。

main.cf文件中添加以下内容:

alias_maps = hash:/etc/postfix/aliases

其实该配置文件中已经有这一条了,只不过是被注释掉的,可以去掉前面的#号来取消注释。

编辑/etc/postfix/aliases文件,将

root: postfix

改为:

root: tom

用以下命令建立别名数据库:

postalias /etc/postfix/aliases

 

七、配置pop3

 

RedHat7.0已经使用xinetd代替了以前的inetd,为了使pop3服务启动,我们编辑/etc/xinetd.d/ipop3文件,将其中的disable = yes改为disable = no 以便启动pop3服务。

为了使改动生效,执行以下命令:

/etc/rc.d/init.d/xinetd reload

 

八、启动postfix

执行以下命令启动postfix:

/etc/rc.d/init.d/postfix start

 

这样,我们就实现了所有的需求:在/etc/postfix/virtual中配置过的用户既可以使用username@test.com 访问邮箱,又可以使用username@test.net 访问邮箱;同时也实现了别名功能,所有发给root的邮件都将被转发给用户tom。根据这个例子,读者应该很容易举一反三,实现更复杂一些的功能。

 

摘自:postfix邮件服务器快速指南



发送邮件常见出错代码
按照下列“Q”代表问题,“A”代表解答。  
Q:the server says:550 relaying mail to <> is not allowed  
Q:The server says:550 <>... relaying denied  
Q:the server says:550 5.7.1 relaying not permitted:  
A:使用某些Smtp服务器时,限制了收件人的地址,只能换一个Smtp服务器。  
Q:The server says:550 <>:local user only  
Q:The server says:550 <>:Invalid User  
Q:The server says:550 Invalid recipient  
A:使用163.net,163.com,yeah.net和netease.com之类的Smtp服务器时,只能用自身的信箱发信,所以要在Foxmail的“帐户属性”中的“个人信息”里面填写正确的邮件地址。  

Q:the server says:551 delivery not allowed to non-local recipient  
Q:The server says:553 Relay restriction.  

Q:The server says:553 From <>, message blocked.  
Q:The server says:553 sorry,you are not allow to use this SMTP to relay your eami  
Q:The server says:553 sorry, that domain isn\'t in my list of allowed rcpthosts  
A:使用21cn.com,china.com,371.net,sina.com等大多数信箱的smtp服务器时,只能用自身的信箱发信,所以要在Foxmail的“帐户属性”中的“个人信息”里面填写正确的邮件地址。  

Q:The server says:505 client was not authenticated  
Q:The server says:553 authentication is required to send mail as <>  
A:使用263.net和sohu.com的Smtp服务器时,不但要用自身的邮箱发信,而且要加入身份验证,所以即要在“个人信息”中填写正确邮箱地址,又要选中“S MTP服务器需要认证”。  

Q:The server says:535 Error:authenticatin failed  
Q:The server says:535 Authentication unsuccessful  
Q:The server says:452 Insufficient system storage  
A:在使用Esmtp认证的过程中出错,检查一下Esmtp设置,多试几次。  

Q:The server says:553 <>...domain name required  
Q:The server says:550 Unable to relay for ...  
A:多出现在用Wingate代理服务器发送邮件时。虽然在Wingate中“POP3 邮箱帐号”要使用“用户名#POP3地址”的格式,但在“帐户属性”中的“个人信息”中还是要填写一般的格式。  

Q:The server says:553 mailbox name not allowed  
A:收件人邮箱地址不允许,需检查收件人地址是否正确。  

Q:the server says:553 sorry, your envelop sender is in my badmailfrom list  
A:服务器限制了收件人的地址,只能换一个smtp服务器发信。  

Q:the server says:554 Transaction failed  
Q:The server says:451 Requested action aborted,errno=28  
A:传输失败,检查网络问题。  

Q:the server says:503 error:needmail command  
Q:The server says:503 need mail before RCPT.  
Q:The server says:503 Bad sequence of commands  
A:消息命令顺序出错,一般出现在其他错误之后,先检查之前出现的错误提示。  

Q:The Server says:501 syntax.helo hostname  
Q:The server says:501 Invalid domain name  
Q:The server says:502 unimplemented command  
Q:the server says:503 5.0.0 polite people say HELO first  
Q:The server says:533 relay restriction  
Q:The server says:544 <>:Recipient address rejected: Relay access denied  
A:传输中的语法错误,原因不明。

阅读(4699) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~