James 2 配置和使用

来源:互联网 发布:office办公软件难学吗 编辑:程序博客网 时间:2024/06/14 10:55

Apache 邮件服务器 James

      james 是Apache下的一个邮件服务器子项目,james 是100% 纯java服务器,支持SMTP Server / POP3 Server 和 NNTP 新闻组服务器,并且具有易配置 /  易扩展 / 性能稳定 等特性。如果不想使用付费的 Mail Server 可以考虑一下 Apache James !

1. 准备工作

  到Apache下载James。当前James版本为 James v2.3.1 .

  到Sun下载JDK1.4以上。

   分别解压到C:/ james-2.3.1 C:/jdk1.6

2. 系统环境配置

  配置系统环境变量:JAVA_HOME=c:/jdk1.6 ; PATH =%JAVA_HOME%/bin;%PATH% ; CLASSPATH=%JAVA_HOME%/lib;

运行cmd测试java环境

c:> java -version

java version 
"1.6.0_01"

Java
(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot
(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)

出现如上信息则配置成功!

启动james.运行run.bat。在c:/james-2.3.1/bin/下。cmd信息如下:如果出现如上信息则表示james启动成功!下面配置james。

Using PHOENIX_HOME:   D:applicationjames-2.3.1
Using PHOENIX_TMPDIR: D:
applicationjames-2.3.1temp
Using JAVA_HOME:      D:
applicationSunJDKJDK6

Phoenix 
4.2

James Mail Server 
2.3.1
Remote Manager Service started plain:
4555
POP3 Service started plain:
110
SMTP Service started plain:
25
NNTP Service started plain:
119
FetchMail Disabled

 

3. james 环境配置

james的配置文件在c:/james-2.3.1/apps/james/SAR-INF/config.xml 下。打开config.xml文件,作如下修改。

修改James Server 主机名称:

      <postmaster>Postmaster@myhost</postmaster>

      
<servernames autodetect="true" autodetectIP="true">

         
<servername>myhost</servername>
      
</servernames>

      
<!--默认localhost-->

      
<postmaster>Postmaster@localhost</postmaster>

      
<servernames autodetect="true" autodetectIP="true">

         
<servername>localhost</servername>
      
</servernames>

添加DNS Server:

在此使用本机作为DNS Server 可以使用专门的DNS Server 。

      <servers>
         
<server>127.0.0.1</server>
      
</servers>

修改自动探测为false .如果为true 可能在开发时出现异常.

<autodiscover>false</autodiscover>

删除一下代码:

<mailet match="RemoteAddrNotInNetwork=127.0.0.1" class="ToProcessor">
            
<processor> relay-denied </processor>
            
<notice>550 - Requested action not taken: relaying denied</notice>
</mailet>

开启SMTP Server 身份验证:

 <authRequired>true</authRequired>

修改James管理员口令:

<account login="root" password="mypassword"/>

ok! 到此 james 配置成功!现在启动james添加几个用户测试一下.

4. James 测试

telnet localhost 4555 到James 远端管理界面,可惜是字符界面.好我们用help命令查看一下 james 的管理命令:

出现如下信息:

Welcome root. HELP for a list of commands
help
Currently implemented commands:
help                                    display this help
listusers                               display existing accounts
countusers                              display the number of existing accounts
adduser [username] [password]           add a new user
verify [username]                       verify if specified user exist
deluser [username]                      delete existing user
setpassword [username] [password]       sets a user's password
setalias [user] [alias]                 locally forwards all email 
for 'user' to
 'alias'
showalias [username]                    shows a user's current email alias
unsetalias [user]                       unsets an alias 
for 'user'
setforwarding [username] [emailaddress] forwards a user's email to another email
 address
showforwarding [username]               shows a user's current email forwarding
unsetforwarding [username]              removes a forward
user [repositoryname]                   change to another user repository
shutdown                                kills the current JVM 
(convenient when J
ames is 
run as a daemon)
quit                                    close connection

我们使用 adduser 用户名 密码 来添加几个用户.

listusers 显示james 上的用户

countusers 显示 james 上的用户数.

deluser 删除用户

quit 退出管理界面

shutdown 停止 James 服务器

ok我们添加两个用户用 OutLook 或 FoxMail 测试一下.

他们的配置:

邮件地址:test@localhost

pop3:localhost

smtp:localhost

ok 客户端配置到此为止,发个邮件测试一下,哈哈,成功了没有!~

 

 

原创粉丝点击