开源Webmail客户端Claros inTouch2.1+James MailServer配置和调试
涂玉韵
2023-12-01
准备:
环境winxp + jdk1.6 + tomcat6.0.16
apache james2.3.2 (邮件服务器)
Claros inTouch2.1.war (WebMail界面程序)
安装:
1、安装james邮件服务容器:james下载后直接解压后启动就可以了
bin目录中的run.bat和run.sh是James的启动程序。
apps目录下在服务器第一次启动之前,只有james.sar、dummy.txt两个文件,第一次启动后apps下会生产其他文件。apps\james\SAR-INF下有一个config.xml是james中的核心配置文件。config.xml是在第一次启动james服务器来。
运行run.dat启动服务器
Java代码
Using PHOENIX_HOME: C:\james-2.3.2
Using PHOENIX_TMPDIR: C:\james-2.3.2\temp
Using JAVA_HOME:
Phoenix 4.2
James Mail Server 2.3.2
Remote Manager Service started plain:4555
POP3 Service started plain:110
SMTP Service started plain:25
NNTP Service started plain:119
FetchMail Disabled
Using PHOENIX_HOME: C:\james-2.3.2
Using PHOENIX_TMPDIR: C:\james-2.3.2\temp
Using JAVA_HOME:
Phoenix 4.2
James Mail Server 2.3.2
Remote Manager Service started plain:4555
POP3 Service started plain:110
SMTP Service started plain:25
NNTP Service started plain:119
FetchMail Disabled
对james_home\apps\james\SAR-INF\config.xml做修改。
1.1:修改自己的邮件服务名
Java代码
<postmaster>Postmaster@localhost.com</postmaster>
<servernames autodetect="true" autodetectIP="true"><!-- 如果将autodetect和autodetectIP设置为false,标识邮件服务器将不侦测ip-->
<servername>localhost.com</servername>
</servernames>
1.2:修改dns服务。
Java代码
<dnsserver>
<servers>
<server>XXXXXX</server>本机IP
<server>XXXXXXX</server>DNS服务地址
</servers>
<!-- 修改自动探测为false 如果为true 可能在开发时出现异常 -->
<autodiscover>false</autodiscover>
<authoritative>false</authoritative>
<maxcachesize>50000</maxcachesize>
</dnsserver>
修改了dns,(在开启smtp验证的情况下)注释掉以下配置,
Java代码
<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 身份验证:
Java代码
<authRequired>true</authRequired>
将位于<smtpserver>标签之间的<authRequired>标签得值设为true
1.3:修改远程管理。以便在cmd控制台中执行telnet byzh.com 4566命令。
Java代码
<remotemanager enabled="true">
<port>4566</port>
<handler>
<helloName autodetect="true">myMailServer</helloName>
<administrator_accounts>
<account login="root" password="123"/>
</administrator_accounts>
<connectiontimeout>60000</connectiontimeout>
<prompt>welcome to mt Sever></prompt>
</handler>
</remotemanager>
1.4:修改pop3,stmp,nntp服务。
Java代码
<pop3server enabled="true">
<port>110</port>
<handler>
<helloName autodetect="true">myMailServer</helloName>
<connectiontimeout>120000</connectiontimeout>
</handler>
</pop3server>
Java代码
<smtpserver enabled="true">
<port>25</port>
<handler>
<helloName autodetect="true">myMailServer</helloName>
<connectiontimeout>360000</connectiontimeout>
<authRequired>true</authRequired>
<authorizedAddresses>127.0.0.0/8</authorizedAddresses>
<maxmessagesize>0</maxmessagesize>
</handler>
</smtpserver>Java代码
<nntpserver enabled="true">
<port>119</port>
<handler>
<helloName autodetect="true">myMailServer</helloName>
<connectiontimeout>120000</connectiontimeout>
<authRequired>false</authRequired>
</handler>
</nntpserver>
1.5:James邮件用户的用户信息默认保存在apps\james\var\users目录下,
通过修改配置文件apps\james\SAR-INF\config.xml,可以把用户信息保存到数据库中,配置方法如下
打开config.xml,找到这一项,此面默认的内容为:
Java代码
<repository name="LocalUsers" class="org.apache.james.userrepository.UsersFileRepository">
<destination URL="file://var/users/"/>
</repository>
需要修改为:
Java代码
<repository name="LocalUsers" class="org.apache.james.userrepository.JamesUsersJdbcRepository"
destinationURL="db://maildb/users">
<sqlFile>file://conf/sqlResources.xml</sqlFile>
</repository>
通过修改,我们就把用户信息的存储介质从file改成了db,是指明了在db中的数据表结构及相关数据库信息。
仍然是config.xml,找到项,注意先要创建好java_mail数据库,把此项内容修改为:
Java代码
<data-source name="maildb" class="org.apache.james.util.mordred.JdbcDataSource">
<driver>com.mysql.jdbc.Driver</driver>
3 <dburl>jdbc:mysql://127.0.0.1:3306/java_mail?useUnicode=true&characterEncoding=gbk</dburl>
<user>root</user>
<password>123</password>
<max>20</max>
</data-source>
<driver>是指MySQL的JDBC驱动,指数据库的访问路径,IP后的mail即MySQL中新建数据库名,接下来是用户名、密码及最大连接数。 需要讲mysql的驱动jar包添加到lib目录下.
至此,数据库配置完成,启动James,若正常无误,请通过telnet添加一个新用户,比如adduser holen 123456,然后检查MySQL中的mail数据库,下面将有一个表users,这是James根据james_home\apps\james\conf的内容创建的。
通过以上配置,James的用户信息就可以保存在数据库中了。
1.6:修改c:/windows/system32/drivers/etc/hosts文件,增加一个地址映射。
Java代码
127.0.0.1 localhost
1.8:执行james_home\bin\run.bat,启动james2.3服务。
1.9:进入命令模式,执行telnet localhost 4566,连接james2.3服务。
2.0:以管理员省份登录james2.3服务,用户就是1.3节配置的root/123。
2.1:添加2个用户 adduser lin lin ,adduser chen chen
2.2:安装claros inTouch,下载claros-intouch-2.1,把intouch2.war拷贝到tomcat中。配置tomcat_home\webapps\intouch2\WEB-INF\config\config.xml。
Java代码
<?xml version="1.0" encoding="UTF-8"?>
<claros-config>
<!-- COMMON PARAMETERS -->
<common-params>
<charset>gbk</charset>
<!-- the timezone is not functional at 2.0 -->
<server-timezone>Europe/Istanbul</server-timezone>
<!-- this directory must be writable (e.g. run a chmod 777 on it) -->
<tmp-dir>/tmp</tmp-dir>
<!-- th e following two is in MB's-->
<max-attachment-size>5</max-attachment-size>
<max-mail-size>10</max-mail-size>
<title>Claros inTouch 2.1</title>
<!-- We recommend running spamassasin. -->
<spam-check-enabled>false</spam-check-enabled>
<!-- valid values are: da, de, en, fr, it, pt_br, pl, sk, tr, vi, zh_cn_utf8 -->
<default-lang>en</default-lang>
<!-- this is the default rss feed. users can set their own -->
<rss-feed>http://rss.cnn.com/rss/cnn_topstories.rss</rss-feed>
</common-params>
<!-- CHAT SERVER SETUP -->
<!-- if you have a jabber server with transports running such as
the MSN, yahoo, icq, aol transports the following transport
domains must be set. If you don't have your own jabber server
or not running transports omit the following settings.
-->
<chat>
<default-domain>claros.org</default-domain>
<msn-transport>msn.claros.org</msn-transport>
<yahoo-transport>yahoo.claros.org</yahoo-transport>
<icq-transport>icq.claros.org</icq-transport>
<aol-transport>aol.claros.org</aol-transport>
</chat>
<!-- MAIL SERVER SETUP -->
<servers>
<server>
<!-- give any name you desire -->
<shortname>localhost</shortname>
<!-- your imap/pop3 server ip/dns -->
<fetch-server>127.0.0.1</fetch-server>
<!-- port you are running the pop3/imap server -->
<!--fetch-server-port>143</fetch-server-port-->
<!-- which protocol? valid values are imap or pop3 (case sensitive) -->
<!--fetch-protocol>imap</fetch-protocol-->
<!-- your smtp server's ip/dns -->
<fetch-server>localhost</fetch-server>
<fetch-server-port>110</fetch-server-port>
<fetch-protocol>pop3</fetch-protocol>
<fetch-ssl>false</fetch-ssl>
<smtp-server>localhost</smtp-server>
<!-- port you are running the smtp server -->
<smtp-server-port>25</smtp-server-port>
<!-- does your smtp server need authentication? -->
<smtp-authenticated>true</smtp-authenticated>
<!-- IMAP only: if you use courier or cyrus you'll need to set the following to "INBOX." (with the dot(.) but omit the quotes) -->
<folder-namespace></folder-namespace>
</server>
</servers>
<!-- THE DATABASE SETUP -->
<!--
Please note that DB setup is essential to work. There is a intouch-mysql file in the SQL directory
of the zip file. Please create a database and dump the sql file to the db.
mysqladmin -u root -p create intouch
mysql -u root -p intouch < intouch-mysql.sql
-->
<db-config>
<db>
<!-- do not change the term file!!! -->
<id>file</id>
<!-- the connection url for the JDBC connection -->
<database>jdbc:mysql://localhost/java_mail?useUnicode=true&characterEncoding=gbk</database>
<!-- the connection class -->
<driver>com.mysql.jdbc.Driver</driver>
<!-- the user with read/write/delete/update/select permission to the database -->
<login>root</login>
<!-- the plain text password -->
<password>123</password>
</db>
</db-config>
</claros-config>
注意点:安装路径不能带空格,不然会找不到config.xml。
正常情况下就可以登录了,数据库使用了是MySQL。
2.3:同样在java_mail数据库中创建inTouch webmail需要的表,sql文件在下载的claros-intouch包中。
2.4:启动tomcat,打开浏览器,
输入http://localhost/intouch2/index.jsp
2.5:登录inTouch WebMail,用户lin/lin。
如果不能登录,可以查看log文件夹底下的log文件,查看出错信息。
附上:安装程序