James服务器的配置

一、下载、配置

大家可以从这里下载到http://james.apache.org/download.cgi james服务器包,解压包。

重点介绍一下两个文件夹bin 和 apps.

bin目录中的run.bat和run.sh是James的启动程序。只要记住这个重要文件就可以。
SAR-INF 下有一个config.xml是james中的核心配置文件。config.xml在第一次启动之前是没有的,需要启动james服务器来生产config.xml文件。
运行run.dat启动服务器,图如下:

二、添加用户
James以telnet 的方式提供了接口用来添加用户.
首先使用telnet来连接james的remote manager .
1.telnet localhost 4555 回车 默认的用户名和密码均是root
三、服务器配置

打开apps\james\SAR-INF\config.xml

设置域名为abc.com

在config.xml文件中,找到<postmaster>Postmaster@localhost</postmaster>,把此项改为<postmaster>Postmaster@abc.com</postmaster>,同理,找到<servername>localhost</servername>,把此项改为<servername>abc.com</servername>。其实,改这两项就是把默认的localhost改为机器名,这样做是为了让其它机器也能访问邮件系统,当然,前提是在局域网上没有与服务器重名的机器。
查找所有 autodetect 属性,修改为 false 。 AutodetectIP 也设为 false.
注释掉
<mailet match="RemoteAddrNotInNetwork=127.0.0.1" class="ToProcessor>
<processor> relay-denied </processor>
<notice>550 - Requested action not taken: relaying denied</notice>
</mailet>

配置 DNS Server ,由于我未配置自己的 DNS 服务器,所以使用 Google 的 Public DNS :

<dnsserver>
<servers>
<server>8.8.8.8</server>
<server>8.8.4.4</server>
</servers>
</dnsserver>
设置 autodiscover 为 false
注意 ,设置 DNS 这步很重要,发送邮件不成功的问题经常会出在这里!
有些文章说 ping 域名提供商管理设置的域名 DNS 来获得 IP ,我试过,这种方法基本上是不行了,所以我使用 Google 的 Public DNS 。
当然,也可以自己做 DNS 服务器,使用 Bind 则可,但其麻烦程度不敢苟同,不建议新手使用!

配置 smtp server , pop3 server 等

查找所有 myMailServer, 替换为你的域名。如:
<helloName autodetect="false">myMailServer</helloName> ,将 myMailServer 修改为你的域名。比如: abc.com

注释以下的语句:
<mailet match="RemoteAddrNotInNetwork=127.0.0.1" class="ToProcessor">
<processor> relay-denied </processor>
<notice>550 - Requested action not taken: relaying denied</notice>
</mailet>

打开 smtp 认证
<authRequired>true</authRequired>
smtp 认证的作用在于不让未能授权的人使用你的邮件服务器发送垃圾邮件,在 <servername></servername> 里指定哪些域名可以使用这个邮件服务器,如:
<servername>abc.com</servername>
<servername>abc.com.cn</servername>
则当发送人地址为 XXX.abc.com 或者 XXX.abc.com.cn 时才能通过,如果写成 XXX.bbc.com 的话就不会通过验证,这种方式就禁止了不法人士使用啦!

修改 root 口令。 account login="root" password="mypassword"

启动 James( 使用 Phoenix.sh) :
./Phoenix.sh start

最后使用 telnet 添加邮件用户 ( 具体命令在 telnet 后输入 help 查看 ) :
telnet server-name 4555



四、FAQ
  1、 在启动james时,提示POP3或SMTP不能使用?
  请检查一下,看“管理工具?>服务”里面,是不是启动了别的邮件服务器,已将110或25端口占用了。
  2、 JAVA_HOME找不到?
  请在run.bat中指定JAVA_HOME,若还不行,请在“我的电脑?>系统?>高级?>环境变量”中添加一项JAVA_HOME(一般不推荐这么做)。
  3、 服务器启动正常,但客户端不能收发邮件?
  请检查客户端配置是否正常,参照前面所讲,另外,请检查james下的config.xml,是否把localhost改成了机器名。





配置外网邮件发送
  本人用的是james2.3.1,官方地址:http://james.apache.org/
  下载地址:http://mirror.utdlug.org/apache/james/server/binaries/james-binary-2.3.1.zip
  下载完如何安装,请自己去google一下。
  下面讲如何配置发送:
  打开..\james\apps\james\SAR-INF\config.xml文件,
  1. 找到<servernames autodetect="true" autodetectIP="true"> 设成 autodetect="false" autodetectIP="false"> autodetct设为true会自动侦测你的主机名,
设成false会用你指定的server name. autodetectIP设为true会为你的servername加上ip.
  2. 设置servername 将默认的为localhost改成你的server名字 如king.cn, 然后打开
C:\WINDOWS\system32\drivers\etc\hosts文件,添加 127.0.0.1 king.cn
  3. 注释掉
<mailet match="RemoteAddrNotInNetwork=127.0.0.1" class="ToProcessor>
<processor> relay-denied </processor>
<notice>550 - Requested action not taken: relaying denied</notice>
</mailet>
  4. 配置DNS Server
在cmd中用ipconfig /all 命令查看你的dns server ip
DNS Servers . . . . . . . . . . . : 202.96.209.6
192.168.1.1
添加如下:
<dnsserver>
<servers>
<server>202.96.209.6</server>
<server>192.168.1.1</server>
同时设置autodiscover为false
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值