现在的位置: 首页 > 综合 > 正文

最近需要系统集成邮箱系统 最终决定选择apache james 3 作为邮箱核心

2014年01月08日 ⁄ 综合 ⁄ 共 6231字 ⁄ 字号 评论关闭

最近需要系统集成邮箱系统  最终决定选择apache james 3 作为邮箱核心  今天调了好长时间 将其转换未mysql 搞了半天也没出来 却报 java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver 看来该版本还不稳定  但是时间不等人 决定将其过程记录下来

 

 

直接将claros-intouch-2.1-bin和 james-server-container-spring-3.0-M3-SNAPSHOT 下载下来 

启动 james 然后 将intouch2.war 放入tomcat容器 

 

这里有个文档 创建 用户 我 就不废话了

Step 0: Requirements
####################

  * JRE 1.5+
  * root (linux/unix) or Administrator (Windows)
  * libc6 (linux)
  * 512MB RAM (launches with -Xmx512M - can use less, can need more, depending on load)

Step 1: Download
#################

  * Download james-server-container-spring-3.0-M2-bin.zip from http://james.apache.org/download.cgi#Apache_James_Server

Step 2: Deploy
##############

  * Unzip james-server-container-spring-3.0-M2-bin.zip.
  * You should have a folder with sub-folders bin, conf, lib, log, var and four text files.

$ unzip james-server-container-spring-3.0-M2-bin.tar.gz
$ cd james-server-container-spring-3.0-M2
$ ls (linux) / dir (windows)
bin
BUILD.txt
conf
lib
LICENSE.txt
log
NOTICE.txt
README.txt
var

Step 3: Understand James Features
#################################

Persistence
- Mailbox is for users' Inbox, Sent Items, Trash... folders - Mailbox persistence is configured in spring-beans.xml (by default jpa, you set the database connection properties in database.properties - can also be maildir=file, jcr). We think to move this config out-of spring-beans.xml.
- Mailstore is for spam, error,... mails, so nothing to do with users visible mails. Available mailstore persistence are defined in mailstore.xml. Each has an URL prefix (file, db, dbfile,...) that can be used in mailetcontainer.xml to define where to store spam,... mails (exemple: file://var/mail/error/).
- Domain persistence is configured in domainlist.xml
- Users persistence is configured in usersrepository.xml
- All database connection use the database.properties in case of database access.

Mailet Container - http://james.apache.org/server/3/feature-mailetcontainer.html

SMTP Hooks - http://james.apache.org/server/3/feature-smtp-hooks.html

Step 4: Configure
#################

  * All configuration files reside in the conf folder.

database.properties
META-INF/persistence.xml
dnsservice.xml
domainlist.xml
fetchmail.xml
imapserver.xml
james-listmanager.xml
jcr-repository.xml
jmx.access
jmx.password
jmx.properties
lmtpserver.xml
log4j.properties
mailetcontainer.xml
mailserver.xml
mailstore.xml
miResources.xml
pop3server.xml
remotemanager.xml
smtpserver.xml
spring-beans.xml
sqlResources.xml
usersrepository.xml
virtualusertable.xml
wrapper.conf
lib folder

James is packaged with virtual hosting disabled, XML domain list, JPA (Derby database) storage for the mails and SMTP Auth.
You can for example edit the following files to change the behaviour:

  * Enable virtual hosting in mailserver.xml: vi mailserver.xml
      <enableVirtualHosting> true </enableVirtualHosting>
      
  * Add the domains in the XMLDomain List or replace the XMLDomainList with the JPADomainList: vi usersrepository.xml
      <domainlist class="org.apache.james.domainlist.jpa.JPADomainList">
        <autodetect>true</autodetect>
        <autodetectIP>true</autodetectIP>
      </domainlist>
      
  * Enable virtual hosting in mailserver.xml: vi mailserver.xml
      <enableVirtualHosting> true </enableVirtualHosting>
      
  * Edit the database.properties and change the values according to your database.

  * Add the needed JDBC driver jar in the ./conf/lib folder according to your database.
  
Step 5: Start
#############

$ cd bin
$ ./james start 

  * !! you need libc6 installed on Linux !! - sudo apt-get install libc6-i386 libc6-dev-i386 on ubuntu
  
  * You can see log result in the log/james-server.log file.

Step 6: Create Domains and Users
################################

Time to add domains and users.
We wil show how to via the remote manager (telnet).
You also can achieve it via JMX.

$ telnet localhost 4555
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
JAMES Remote Administration Tool
Please enter your login and password
Login id:
root
Password:
root
Welcome root. HELP for a list of commands
adddomain YOUR_DOMAIN
Adding domain YOUR_DOMAIN successful
adduser YOUR_NAME@YOUR_DOMAIN YOUR_PASSWORD
User YOUR_NAME@YOUR_DOMAIN added
quit
Bye
Connection closed by foreign host.

  * For example, YOUR_DOMAIN=localhost.net, YOUR_NAME=test, so you will have a test@localhost.net user.
  * The username to use in you mail client will be test@localhost.net.

Step 7: Test
############

$ telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 172.16.1.131 SMTP Server (JAMES SMTP Server 3.0-M2) ready Sat, 6 Nov 2010 17:31:33 +0100 (CET)
ehlo test
250-172.16.1.131 Hello test (aoscommunity.com [127.0.0.1])
250-PIPELINING
250-ENHANCEDSTATUSCODES
250 8BITMIME
mail from:<YOUR_NAME@YOUR_DOMAIN>
250 2.1.0 Sender <YOUR_NAME@YOUR_DOMAIN> OK
rcpt to:<YOUR_NAME@YOUR_DOMAIN>
250 2.1.5 Recipient <YOUR_NAME@YOUR_DOMAIN> OK
data
354 Ok Send data ending with <CRLF>.<CRLF>
subject: test

this is a test
.
250 2.6.0 Message received
quit
Connection closed by foreign host.

Step 8: Manage
##############

8.1. Manage via telnet

$ telnet localhost 4555
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
JAMES Remote Administration Tool
Please enter your login and password
Login id:
root
Password:
root
Welcome root. HELP for a list of commands
help
adddomain [domainname]  add domain to local domains
addmapping [toUser@toDomain] [fromMapping]      add mapping for the given emailaddress
adduser [username] [password]   add a new user
countusers      display the number of existing accounts
deluser [username]      delete existing user
help    displays this help
listallmappings list all mappings
listdomains     list local domains
listmapping [user@domain]       list all mappings for the given emailaddress
listusers       display existing accounts
memstat ([-gc]) shows memory usage. When called with -gc the garbage collector get called
quit    close connection
removedomain [domainname]       remove domain from local domains
removemapping [toUser@toDomain] [fromMapping]   remove mapping for the given emailaddress
setpassword [username] [password]       sets a user's password
showalias [username]    shows a user's current email alias
showforwarding [username]       shows a user's current email forwarding
shutdown        kills the current JVM (convenient when James is run as a daemon)
unsetalias [user]       unsets an alias for 'user'
unsetforwarding [username]      removes a forward
user [repositoryname]   change to another user repository
verify [username]       verify if specified user exist

8.2. Manage via JMX

  * Launch jconsole (or any other JMX client) and connect on URL=service:jmx:rmi:///jndi/rmi://localhost:9999/jmxrmi

Step 9: Monitor
###############

  * Monitor the ./log/james-server.log log file.

  * Monitor via JMX (launch any JMX client and connect to URL=service:jmx:rmi:///jndi/rmi://localhost:9999/jmxrmi)

  * Check ./var folder usage
  
    mail
    +-error
    +-address-error
    +-relay-denied
    +-spam

    store
    +-maildir
    +-derby
    +-jackrabbit
    +-activemq
      +-brokers
        +-james
      +-blob-transfer
        +-outgoing
        +-spool
 

  * Check /tmp folder usage 

 

打开 浏览器 访问  发现http://127.0.0.1:8080/intouch2/ 可以访问  这是第一步 其他都没有设置  所以里面导出报错 

抱歉!评论已关闭.