准备:
环境winxp + jdk1.6 + tomcat6.0.16
apache james2.3
(邮件服务器)
Claros inTouch2.1.war (WebMail界面程序)
安装:
1、安装james邮件服务容器:james下载后直接解压后启动就可以了,
对james_home\apps\james\SAR-INF\config.xml做修改。
1.1:修改自己的邮件服务名,如同
abc123@byzh.com
1 <postmaster>Postmaster@byzh.com</postmaster>
2 <servernames autodetect="true" autodetectIP="true">
3 <servername>byzh.com</servername>
4 </servernames>
1.2:修改dns服务。
1<dnsserver>
2 <servers>
3 <server>byzh.com</server>
4 <server>smtp.163.com</server>
5 <server>mail.126.com</server>
6 </servers>
7 <!-- 修改自动探测为false 如果为true 可能在开发时出现异常 -->
8 <autodiscover>false</autodiscover>
9 <authoritative>false</authoritative>
10 <maxcachesize>50000</maxcachesize>
11</dnsserver> 修改了dns,就要注释掉以下配置
1<mailet match="RemoteAddrNotInNetwork=127.0.0.1" class="ToProcessor">
2 <processor> relay-denied </processor>
3 <notice>550 - Requested action not taken: relaying denied</notice>
4</mailet> 并且,开启SMTP Server 身份验证:
1<authRequired>true</authRequired>
1.3:修改远程管理。以便在cmd控制台中执行telnet byzh.com 4566命令。
1 <remotemanager enabled="true">
2 <port>4566</port>
3 <handler>
4 <helloName autodetect="true">myMailServer</helloName>
5 <administrator_accounts>
6 <account login="root" password="123456"/>
7 </administrator_accounts>
8 <connectiontimeout>60000</connectiontimeout>
9 <prompt>welcome to mt Sever></prompt>
10 </handler>
11 </remotemanager>
1.4:修改pop3,stmp,nntp服务。
1 <pop3server enabled="true">
2 <port>110</port>
3 <handler>
4 <helloName autodetect="true">myMailServer</helloName>
5 <connectiontimeout>120000</connectiontimeout>
6 </handler>
7</pop3server>
8 <smtpserver enabled="true">
9 <port>25</port>
10 <handler>
11 <helloName autodetect="true">myMailServer</helloName>
12 <connectiontimeout>360000</connectiontimeout>
13 <authRequired>true</authRequired>
14 <authorizedAddresses>127.0.0.0/8</authorizedAddresses>
15 <maxmessagesize>0</maxmessagesize>
16 </handler>
17 </smtpserver>
18 <nntpserver enabled="true">
19 <port>119</port>
20 <handler>
21 <helloName autodetect="true">myMailServer</helloName>
22 <connectiontimeout>120000</connectiontimeout>
23 <authRequired>false</authRequired>
24 </handler>
25 </nntpserver>
1.5:
James邮件用户的用户信息默认保存在apps\james\var\users目录下,
通过修改配置文件apps\james\SAR-INF\config.xml,可以把用户信息保存到数据库中,
配置方法如下 打开config.xml,找到<users-store>这一项,此面默认的内容为:
1 <repository name="LocalUsers" class="org.apache.james.userrepository.UsersFileRepository">
2 <destination URL="file://var/users/"/>
3 </repository>
需要修改为:
1 <repository name="LocalUsers" class="org.apache.james.userrepository.JamesUsersJdbcRepository"
destinationURL="db://maildb/users">
2 <sqlFile>file://conf/sqlResources.xml</sqlFile>
3 </repository>
通过修改,我们就把用户信息的存储介质从file改成了db,<sqlFile>是指明了在db中的数据表结构及相关数据库信息。
仍然是config.xml,找到<data-sources>项,注意先要创建好java_mail数据库,把此项内容修改为:
1 <data-source name="maildb" class="org.apache.james.util.mordred.JdbcDataSource">
2 <driver>com.mysql.jdbc.Driver</driver>
3 <dburl>jdbc:mysql://127.0.0.1:3306/java_mail?useUnicode=true&characterEncoding=UTF-8</dburl>
4 <user>root</user>
5 <password>root</password>
6 <max>20</max>
7 </data-source>
<driver>是指MySQL的JDBC驱动,<dburl>指数据库的访问路径,IP后的mail即MySQL中新建数据库
名,接下来是用户名、密码及最大连接数。
至此,数据库配置完成,启动James,若正常无误,请通过telnet添加一个新用户,比如adduser holen
123456,然后检查MySQL中的mail数据库,下面将有一个表users,这是James根据james_home\apps\james
\conf的内容创建的。
通过以上配置,James的用户信息就可以保存在数据库中了。
1.6:修改c:/windows/system32/drivers/etc/hosts文件,增加一个地址映射。
1 #192.168.0.100 byzh.com
2 127.0.0.1 byzh.com
1.8:执行james_home\bin\run.bat,启动james2.3服务。
1.8:进入命令模式,执行telnet byzh.com 4566,连接james2.3服务。
1.9:以管理员省份登录james2.3服务,用户就是1.3节配置的root/123456。
1.9.1:添加2个用户,a/123456,b/123456。
2:安装claros
inTouch,下载claros-intouch-2.1,把intouch2.war拷贝到tomcat中。配置
tomcat_home\webapps\intouch2\WEB-INF\config\config.xml。
<?xml version="1.0" encoding="UTF-8"?>
<claros-config>
<common-params>
<charset>utf-8</charset>
<server-timezone>Europe/Istanbul</server-timezone>
<tmp-dir>/tmp</tmp-dir>
<max-attachment-size>5</max-attachment-size>
<max-mail-size>10</max-mail-size>
<title>Claros inTouch 2.1</title>
<spam-check-enabled>false</spam-check-enabled>
<default-lang>zh_cn_utf8</default-lang>
<rss-feed>http://rss.cnn.com/rss/cnn_topstories.rss</rss-feed>
</common-params>
<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>
<servers>
<server>
<shortname>byzh.com</shortname>
<!-- your imap/pop3 server ip/dns
<fetch-server-port>143</fetch-server-port>
<fetch-protocol>imap</fetch-protocol>
-->
<fetch-server>byzh.com</fetch-server>
<fetch-server-port>110</fetch-server-port>
<fetch-protocol>pop3</fetch-protocol>
<fetch-ssl>false</fetch-ssl>
<smtp-server>byzh.com</smtp-server>
<smtp-server-port>25</smtp-server-port>
<smtp-authenticated>true</smtp-authenticated>
<, smtp-ssl>false</smtp-ssl>
<!-- 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>
<db-config>
<db>
<!-- do not change the term file -->
<id>file</id>
<database>jdbc:mysql://127.0.0.1:3306/java_mail?useUnicode=true&characterEncoding=UTF-8</database>
<driver>com.mysql.jdbc.Driver</driver>
<login>root</login>
<password>root</password>
</db>
</db-config>
</claros-config>
注意点:安装路径不能带空格,不然会找不到config.xml。
正常情况下就可以登录了,数据库使用了是MySQL。
2.1:同样在java_mail数据库中创建inTouch webmail需要的表,sql如下:
1 CREATE TABLE `CALENDAR_OBJECTS` (
2 `ID` bigint(20) unsigned NOT NULL auto_increment,
3 `USERNAME` varchar(255) NOT NULL default '',
4 `RECORD_DATE` timestamp NOT NULL,
5 `REPEAT_TYPE` int(11) NOT NULL default '0',
6 `CATEGORY` varchar(255) NOT NULL default '',
7 `DESCRIPTION` text NOT NULL,
8 `REMINDER_DAYS` int(11) NOT NULL default '0',
9 PRIMARY KEY (`ID`)
10 ) ENGINE= InnoDB default charset=utf8;
11
12 # Dump of table CONTACTS
13 # ------------------------------------------------------------
14
15 CREATE TABLE `CONTACTS` (
16 `ID` bigint(20) unsigned NOT NULL auto_increment,
17 `USERNAME` varchar(255) default '',
18 `FIRST_NAME` varchar(100) NOT NULL default '',
19 `MIDDLE_NAME` varchar(100) default '',
20 `LAST_NAME` varchar(100) NOT NULL default '',
21 `TITLE` varchar(50) default '',
22 `SEX` varchar(10) default '',
23 `GSM_NO_PRIMARY` varchar(30) default '',
24 `GSM_NO_ALTERNATE` varchar(30) default '',
25 `EMAIL_PRIMARY` varchar(255) default '',
26 `EMAIL_ALTERNATE` varchar(255) default '',
27 `WEB_PAGE` varchar(255) default '',
28 `PERSONAL_NOTE` text,
29 `SPOUSE_NAME` varchar(255) default '',
30 `NICK_NAME` varchar(50) default '',
31 `HOME_ADDRESS` text,
32 `HOME_CITY` varchar(255) default '',
33 `HOME_PROVINCE` varchar(255) default '',
34 `HOME_ZIP` varchar(5) default '',
35 `HOME_COUNTRY` varchar(100) default '',
36 `HOME_PHONE` varchar(30) default '',
37 `HOME_FAKS` varchar(30) default '',
38 `WORK_COMPANY` varchar(100) default '',
39 `WORK_JOB_TITLE` varchar(100) default '',
40 `WORK_DEPARTMENT` varchar(100) default '',
41 `WORK_OFFICE` varchar(100) default '',
42 `WORK_PROFESSION` varchar(100) default '',
43 `WORK_MANAGER_NAME` varchar(255) default '',
44 `WORK_ASSISTANT_NAME` varchar(255) default '',
45 `WORK_ADDRESS` text,
46 `WORK_CITY` varchar(255) default '',
47 `WORK_PROVINCE` varchar(255) default '',
48 `WORK_ZIP` varchar(5) default '',
49 `WORK_COUNTRY` varchar(100) default '',
50 `WORK_PHONE` varchar(30) default '',
51 `WORK_FAKS` varchar(30) default '',
52 `BIRTH_DAY` varchar(2) default NULL,
53 `ANNIVERSARY_DAY` varchar(2) default NULL,
54 `BIRTH_MONTH` varchar(2) default NULL,
55 `ANNIVERSARY_MONTH` varchar(2) default NULL,
56 PRIMARY KEY (`ID`)
57 ) ENGINE= InnoDB default charset=utf8;
58
59 # Dump of table CONTACT_GROUPS
60 # ------------------------------------------------------------
61
62 CREATE TABLE `CONTACT_GROUPS` (
63 `ID` bigint(20) unsigned NOT NULL auto_increment,
64 `USERNAME` varchar(255) NOT NULL default '',
65 `SHORT_NAME` varchar(100) default '',
66 `DESCRIPTION` varchar(255) default '',
67 PRIMARY KEY (`ID`)
68 ) ENGINE= InnoDB default charset=utf8;
69
70 # Dump of table CONTACT_GROUP_OBJECTS
71 # ------------------------------------------------------------
72
73 CREATE TABLE `CONTACT_GROUP_OBJECTS` (
74 `ID` bigint(20) unsigned NOT NULL auto_increment,
75 `USERNAME` varchar(255) NOT NULL default '',
76 `GROUP_ID` bigint(20) NOT NULL default '0',
77 `CONTACT_ID` bigint(20) NOT NULL default '0',
78 PRIMARY KEY (`ID`)
79 ) ENGINE= InnoDB default charset=utf8;
80
81
82
83 # Dump of table FOLDER_DB_OBJECTS
84 # ------------------------------------------------------------
85
86 CREATE TABLE `FOLDER_DB_OBJECTS` (
87 `ID` bigint(20) unsigned NOT NULL auto_increment,
88 `USERNAME` varchar(255) default NULL,
89 `PARENT_ID` bigint(20) default '0',
90 `FOLDER_NAME` varchar(100) NOT NULL default '',
91 `FOLDER_TYPE` int(10) unsigned NOT NULL default '4',
92 PRIMARY KEY (`ID`),
93 KEY `USERNAME` (`USERNAME`)
94 ) ENGINE= InnoDB default charset=utf8;
95
96 # Dump of table MSG_DB_OBJECTS
97 # ------------------------------------------------------------
98
99 CREATE TABLE `MSG_DB_OBJECTS` (
100 `ID` bigint(20) unsigned NOT NULL auto_increment,
101 `USERNAME` varchar(255) NOT NULL default '',
102 `FOLDER_ID` bigint(20) unsigned NOT NULL default '0',
103 `UNIQUE_ID` varchar(100) NOT NULL default '',
104 `UNREAD` tinyint(1) default '0',
105 `MSG_SIZE` bigint(20) unsigned NOT NULL default '0',
106 `EMAIL` longblob,
107 PRIMARY KEY (`ID`)
108 ) ENGINE= InnoDB default charset=utf8;
109
110
111 # Dump of table MSG_RULES
112 # ------------------------------------------------------------
113
114 CREATE TABLE `MSG_RULES` (
115 `ID` bigint(20) unsigned NOT NULL auto_increment,
116 `USERNAME` varchar(255) NOT NULL default '',
117 `PORTION` varchar(100) default NULL,
118 `RULE_CONDITION` varchar(30) default NULL,
119 `KEYWORD` varchar(255) default NULL,
120 `RULE_ACTION` varchar(30) default NULL,
121 `DESTINATION` varchar(100) default NULL,
122 PRIMARY KEY (`ID`),
123 KEY `USERNAME` (`USERNAME`)
124 ) ENGINE= InnoDB default charset=utf8;
125
126 # Dump of table NOTES
127 # ------------------------------------------------------------
128
129 CREATE TABLE `NOTES` (
130 `ID` bigint(20) unsigned NOT NULL auto_increment,
131 `USERNAME` varchar(255) NOT NULL default '',
132 `FOLDER_ID` bigint(20) NOT NULL default '0',
133 `NOTE_CONTENT` text,
134 `POS_LEFT` int(11) default NULL,
135 `POS_TOP` int(11) default NULL,
136 `POS_WIDTH` int(11) default NULL,
137 `POS_HEIGHT` int(11) default NULL,
138 `NOTE_COLOR` varchar(20) default NULL,
139 `NOTE_BAR_COLOR` varchar(20) default NULL,
140 `NOTE_BORDER_COLOR` varchar(20) default NULL,
141 `NOTE_DATE` datetime default NULL,
142 PRIMARY KEY (`ID`)
143 ) ENGINE= InnoDB default charset=utf8;
144
145 # Dump of table NOTES_FOLDERS
146 # ------------------------------------------------------------
147
148 CREATE TABLE `NOTES_FOLDERS` (
149 `ID` bigint(20) unsigned NOT NULL auto_increment,
150 `USERNAME` varchar(255) NOT NULL default '',
151 `FOLDER_NAME` varchar(255) NOT NULL default '',
152 PRIMARY KEY (`ID`)
153 ) ENGINE= InnoDB default charset=utf8;
154
155 # Dump of table PREFERENCES
156 # ------------------------------------------------------------
157
158 CREATE TABLE `PREFERENCES` (
159 `ID` bigint(20) unsigned NOT NULL auto_increment,
160 `USERNAME` varchar(255) NOT NULL,
161 `PREF_KEY` varchar(255) NOT NULL,
162 `PREF_VALUE` varchar(255) NOT NULL,
163 PRIMARY KEY (`ID`)
164 ) ENGINE= InnoDB default charset=utf8;
165
166 # Dump of table QUEUE
167 # ------------------------------------------------------------
168
169 CREATE TABLE `QUEUE` (
170 `ID` bigint(20) unsigned NOT NULL auto_increment,
171 `MSG_FROM` varchar(255) NOT NULL default '',
172 `MSG_TO` varchar(255) NOT NULL,
173 `MSG_TIME` timestamp NOT NULL,
174 `MSG_BODY` longtext NOT NULL,
175 `MSG_DIRECTION` varchar(3) NOT NULL,
176 `DELIVERED` int(11) NOT NULL default '0',
177 PRIMARY KEY (`ID`)
178 ) ENGINE= InnoDB default charset=utf8;
179
180 # Dump of table USER_PREFERENCES
181 # ------------------------------------------------------------
182
183 CREATE TABLE `USER_PREFERENCES` (
184 `ID` bigint(20) unsigned NOT NULL auto_increment,
185 `USERNAME` varchar(255) NOT NULL default '',
186 `KEYWORD` varchar(255) NOT NULL default '',
187 `PREF_VALUE` varchar(255) NOT NULL default '',
188 PRIMARY KEY (`ID`)
189 ) ENGINE= InnoDB default charset=utf8;
2.2:启动tomcat,打开浏览器,输入http://localhost:8080/intouch2/index.jsp
2.3:登录inTouch WebMail,用户b/123456。
如果不能登录,可以查看log文件夹底下的log文件,查看出错信息。