用户名: 密码: [免费注册] [忘记密码]
您的位置:首页 -- jsp技术
Apache James Server 3.0配置
发布日期:2012-12-13     返回

Apache James Server 3.0部署参考

(1)下载地址http://james.apache.org/download.cgi#Apache_James_Server

(下载的版本是3.0)

(2)安装

下载后,将其解压到C盘

      

(3)James Server的配置文件:

打开目录:

C:\james-server-container-spring-3.0-M2-bin\james-server-container-spring-3.0-M2\conf

James Server所需要的配置文件目录如下:

 

①配置服務器的域名:用寫字板打開mailserver.xml文件

改為如下內容:

<mailserver>

  <postmaster>Postmaster@emm.edu.mo</postmaster>

  <enableVirtualHosting>false</enableVirtualHosting>     

  <defaultDomain>emm.edu.mo</defaultDomain>

  <helloName autodetect="false">emm.edu.mo</helloName>

</mailserver>

參考資料:

https://svn.apache.org/repos/asf/james/server/tags/james-server-3.0-M2/container-spring/src/main/config/examples/usersrepository.xml

 

②配置鏈接外網的域名:用寫字板打開dnsservice.xml文件。

找到<dnsservice>結構改為一下內容:

<dnsservice>

<servers>

<server>ip address</server>

    <server>emm.edu.mo</server>

    </servers>

    <autodiscover>false</autodiscover>

    <authoritative>false</authoritative>

    <maxcachesize>50000</maxcachesize>

</dnsservice>

 

參考資料:

https://svn.apache.org/repos/asf/james/server/tags/james-server-3.0-M2/container-spring/src/main/config/examples/dnsservice.xml

 

③配置預處理郵件服務域名:用寫字板打開dominlist.xml文件

找到<domainlists>結構,改為一下內容:

<domainlists>

  <domainlist class="org.apache.james.domainlist.xml.XMLDomainList">

    <domainnames>

      <domainname>emm.edu.mo</domainname>

    </domainnames>

    <autodetect>false</autodetect>

    <autodetectIP>false</autodetectIP>

  </domainlist>

</domainlists>

 

參考資料:

https://svn.apache.org/repos/asf/james/server/tags/james-server-3.0-M2/container-spring/src/main/config/examples/domainlist.xml

 

④支持OpenDS配置:用寫字板打開userrepository.xml文件

 

找到<usersrepository>結構,把以下內容註釋掉:

 

  <repository name="LocalUsers" class="org.apache.james.user.jpa.JPAUsersRepository">

      <algorithm>MD5</algorithm>

  </repository>

 

 

添加以下代碼:

<repository name="LocalUsers"

        class="org.apache.james.user.ldap.ReadOnlyUsersLDAPRepository"

        ldapHost="ldap://localhost:389" principal="cn=Directory Manager"

        credentials="123456" userBase="dc=erip,dc=metaarchit"

        userIdAttribute="cn" userObjectClass="inetOrgPerson">

        <restriction memberAttribute="uniqueMember">

            <group>cn=StudentMember,dc=erip,dc=metaarchit</group>

        </restriction>

</repository>

 

(userIdAttribute屬性是用來在OpenDS中獲取用戶的用戶名的,默認是DS中Entry的cn屬性。我們可以根據需要換成sn、uid、mail都可以)

如下圖是OpenDS新增用戶的面板:

 

常用名->cn

命令屬性->userIdAttribute

 

參考資料:

http://james.apache.org/server/3/apidocs/org/apache/james/user/ldap/ReadOnlyUsersLDAPRepository.html

 

(4)James使用Mysql儲存郵件

C:\james-server-container-spring-3.0-M2\conf

 

①找到database.properties文件

把數據庫連接信息修改如下內容:

database.driverClassName=com.mysql.jdbc.Driver

database.url=jdbc:mysql://localhost:3306/mail

database.username=root

database.password=root

vendorAdapter.database=MYSQL

openjpa.streaming=false

 

②找到mailstore.xml文件

在<mailstore>結構內添加如下內容:

<mailstore>

  <repositories>

....

</repositories>

<database-connections>

        <data-source name="maildb"

            class="org.apache.james.util.mordred.JdbcDataSource">

            <driver>com.mysql.jdbc.Driver</driver>

            <dburl>jdbc:mysql://localhost:3306/mail</dburl>

            <user>root</user>

            <password>root</password>

            <max>20</max>

        </data-source>

</database-connections>

<spoolRepository>

   <repository destinationURL="dbfile://maildb/spool/spool" type="SPOOL"/>

</spoolRepository>

<inboxRepository>

   <repository destinationURL="db://maildb/inbox/" type="MAIL"/>

</inboxRepository>

</mailstore>

 

③把mysql的驅動包拷貝到目錄

C:\james-server-container-spring-3.0-M2\conf\lib下。

 

④在mysql新建名為mail(名字可以隨便起,但要跟database文件和mailstore文件一致)的數據庫。

 

 

(5)啟動JamesServer

打開目錄:C:\james-server-container-spring-3.0-M2\bin

文件結構如下圖:

 

找到run.bat文件打開(可直接雙擊,或者通過命令行)

如果窗体没有error信息,說明Server啟動成功(組合鍵ctrl+c關閉Server)

(6)測試James Server啟動成功否

打開命令行,輸入telnet emm.edu.mo 4555 回車

輸入loginId和loginpassword都是root 

 

root是默認的,如果需要修改可以打開remotemanager.xml文件按照以下方式进行修改:

①找到<remotemanager enabled="true">tag 下的<port>端口(默認是4555)

 

②找到<administrator_accounts> tag 下的<account login="root" password="root"/>

修改相應的login和password(默認是root)

 

參考資料:

http://james.apache.org/server/3/apidocs/org/apache/james/user/ldap/ReadOnlyUsersLDAPRepository.html

 

如果James Server服務器啟動成功:

 

 

然後可以通過輸入help 獲取命令提示,當然由於鏈接OpenDS是只讀的,所以只可以使用listusers命令,如下圖:

 

最後,James Server部署完畢。

 

典型客户
JAVA技术
 
域信息科技提供专业的jsp空间服务,jsp空间,jsp空间租用,jsp空间购买,虚拟JSP主机,jsp主机,独享TOMCAT,JSP服务器
售前电话:400-004-4994
售后电话:400-004-4994
技术支持(7×24支持):400-004-4994 018241839456
公司地址:阜新市中华路65号新天地大厦9F
邮编:123000       传真:0418-2493388-606
经营性ICP证:辽B-2-4-20070114    ICP备案: 辽ICP备07005704号
域信息科技提供专业的jsp空间,虚拟JSP主机,jsp主机,独享TOMCAT,JSP服务器
域信息科技提供专业的jsp空间,虚拟JSP主机,jsp主机,独享TOMCAT,JSP服务器