posts - 40, comments - 58, trackbacks - 0, articles - 0
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

Apache James 收发内外网邮件的配置

Posted on 2008-08-25 15:35 Astro.Qi 阅读(5315) 评论(4)  编辑  收藏 所属分类: Java
说明:1.James2.3.1部署的这台机器的域名是xizangmilin.gov.cn 对应的外网IP是202.98.244.10
      2.dns是202.98.224.69
      3.hosts文件中的IP映射是202.98.244.10  xizangmilin.gov.cn
      4.以下是配置文件的原型,注意红色部分
  1 <?xml version="1.0"?>
  2 <!DOCTYPE config [
  3 <!ENTITY listserverConfig SYSTEM "../conf/james-listmanager.xml">
  4 <!ENTITY listserverStores SYSTEM "../conf/james-liststores.xml">
  5 <!ENTITY fetchmailConfig SYSTEM "../conf/james-fetchmail.xml">
  6 <!ENTITY smtphandlerchainConfig SYSTEM "../conf/james-smtphandlerchain.xml">
  7 ]>
  8 
  9 <config>
 10    <James>
 11 
 12       <postmaster>Postmaster@xizangmilin.gov.cn</postmaster>
 13       <servernames autodetect="false" autodetectIP="false">
 14          <servername>xizangmilin.gov.cn</servername>
 15       </servernames>
 16 
 17       <usernames ignoreCase="true" enableAliases="true" enableForwarding="true"/>
 18 
 19       <inboxRepository>
 20          <repository destinationURL="file://var/mail/inboxes/" type="MAIL"/>
 21       </inboxRepository>
 22 
 23    </James>
 24 
 25    &fetchmailConfig;
 26 
 27    <mailetpackages>
 28       <mailetpackage>org.apache.james.transport.mailets</mailetpackage>
 29       <mailetpackage>org.apache.james.transport.mailets.smime</mailetpackage>
 30    </mailetpackages>
 31    <matcherpackages>
 32       <matcherpackage>org.apache.james.transport.matchers</matcherpackage>
 33       <matcherpackage>org.apache.james.transport.matchers.smime</matcherpackage>
 34    </matcherpackages>
 35 
 36    <spoolmanager>
 37       <threads> 10 </threads>
 38       <processor name="root">
 39          <mailet match="All" class="PostmasterAlias"/>
 40          <mailet match="RelayLimit=30" class="Null"/>
 41          <mailet match="HasMailAttributeWithValue=org.apache.james.infected, true" class="ToProcessor">
 42             <processor> virus </processor>
 43          </mailet>
 44          <mailet match="HasMailAttribute=spamChecked" class="ToProcessor">
 45             <processor> transport </processor>
 46          </mailet>
 47 
 48          <mailet match="All" class="SetMailAttribute">
 49             <spamChecked>true</spamChecked>
 50          </mailet>
 51          <mailet match="SMTPAuthSuccessful" class="ToProcessor">
 52             <processor> transport </processor>
 53          </mailet>
 54 
 55          <mailet match="InSpammerBlacklist=query.bondedsender.org."
 56                  class="ToProcessor">
 57            <processor> transport </processor>
 58          </mailet>
 59 
 60          <mailet match="InSpammerBlacklist=dnsbl.njabl.org."
 61                  class="ToProcessor">
 62            <processor> spam </processor>
 63            <notice>550 Requested action not taken: rejected - see http://njabl.org/ </notice>
 64          </mailet>
 65          
 66          <mailet match="All" class="ToProcessor">
 67             <processor> transport </processor>
 68          </mailet>
 69       </processor>
 70 
 71       <processor name="error">
 72          <mailet match="All" class="ToRepository">
 73             <repositoryPath> file://var/mail/error/</repositoryPath>
 74          </mailet>
 75       </processor>
 76       <processor name="transport">
 77 
 78          <mailet match="SMTPAuthSuccessful" class="SetMimeHeader">
 79             <name>X-UserIsAuth</name>
 80             <value>true</value>
 81          </mailet>
 82     
 83          <mailet match="HasMailAttribute=org.apache.james.SMIMECheckSignature" class="SetMimeHeader">
 84             <name>X-WasSigned</name>
 85             <value>true</value>
 86          </mailet>
 87 
 88          <mailet match="RecipientIsLocal" class="LocalDelivery"/>
 89 
 90          <mailet match="HostIsLocal" class="ToProcessor">
 91             <processor> local-address-error </processor>
 92             <notice>550 - Requested action not taken: no such user here</notice>
 93          </mailet>
 94 
 95          <mailet match="All" class="RemoteDelivery">
 96             <outgoing> file://var/mail/outgoing/ </outgoing>
 97             <delayTime>  5 minutes </delayTime>
 98             <delayTime> 10 minutes </delayTime>
 99             <delayTime> 45 minutes </delayTime>
100             <delayTime>  2 hours </delayTime>
101             <delayTime>  3 hours </delayTime>
102             <delayTime>  6 hours </delayTime>
103             <maxRetries> 25 </maxRetries>
104             <deliveryThreads> 1 </deliveryThreads>
105             <sendpartial>false</sendpartial>
106             <bounceProcessor>bounces</bounceProcessor>
107          </mailet>
108       </processor>
109       
110       <processor name="spam">
111          <mailet match="All" class="ToRepository">
112             <repositoryPath>file://var/mail/spam/</repositoryPath>
113          </mailet>
114       </processor>
115 
116       <processor name="virus">
117          <mailet match="All" class="SetMailAttribute">
118             <org.apache.james.infected>true, bouncing</org.apache.james.infected>
119          </mailet>
120          <mailet match="SMTPAuthSuccessful" class="Bounce">
121             <inline>heads</inline>
122             <attachment>none</attachment>
123             <notice> Warning: We were unable to deliver the message below because it was found infected by virus(es). </notice>
124          </mailet>
125 
126          <mailet match="All" class="Null" />
127       </processor>
128 
129       
130       <processor name="local-address-error">
131          <mailet match="All" class="ToRepository">
132             <repositoryPath> file://var/mail/address-error/</repositoryPath>
133          </mailet>
134       </processor>
135 
136       <processor name="relay-denied">
137          <mailet match="All" class="ToRepository">
138             <repositoryPath>file://var/mail/relay-denied/</repositoryPath>
139          </mailet>
140       </processor>
141 
142       <processor name="bounces">
143          <mailet match="All" class="DSNBounce">
144             <passThrough>false</passThrough>
145           </mailet>
146       </processor>
147    </spoolmanager>
148 
149 
150    <dnsserver>
151       <servers>
152           <server>202.98.224.69</server>            <!-- dns -->
153           <server>xizangmilin.gov.cn</server>       <!-- localhost -->
154       </servers>
155       <autodiscover>false</autodiscover>
156       <authoritative>false</authoritative>
157       <maxcachesize>50000</maxcachesize>
158    </dnsserver>
159 
160    <remotemanager enabled="true">
161       <port>4555</port>
162       <handler>
163          <helloName autodetect="true">myMailServer</helloName>
164          <administrator_accounts>
165             <account login="root" password="123456"/>
166          </administrator_accounts>
167          <connectiontimeout> 60000 </connectiontimeout>
168       </handler>
169    </remotemanager>
170 
171    <pop3server enabled="true">
172       <port>110</port>
173 
174       <handler>
175          <helloName autodetect="true">myMailServer</helloName>
176          <connectiontimeout>120000</connectiontimeout>
177       </handler>
178    </pop3server>
179 
180    <smtpserver enabled="true">
181       <port>25</port>
182       <handler>
183          <helloName autodetect="true">myMailServer</helloName>
184          <connectiontimeout>360000</connectiontimeout>
185          <authRequired>true</authRequired>
                   <verifyIdentity>true</verifyIdentity>
186          <authorizedAddresses>127.0.0.0/8</authorizedAddresses>
187          <maxmessagesize>0</maxmessagesize>
188       </handler>
189    </smtpserver>
190 
191    <nntpserver enabled="true">
192       <port>119</port>
193       <handler>
194          <helloName autodetect="true">myMailServer</helloName>
195          <connectiontimeout>120000</connectiontimeout>
196          <authRequired>false</authRequired>
197       </handler>
198    </nntpserver>
199 
200    <nntp-repository>
201       <readOnly>false</readOnly>
202 
203       <rootPath>file://var/nntp/groups</rootPath>
204       <tempPath>file://var/nntp/temp</tempPath>
205       <articleIDPath>file://var/nntp/articleid</articleIDPath>
206       <articleIDDomainSuffix>news.james.apache.org</articleIDDomainSuffix>
207       <newsgroups>
208          <newsgroup>org.apache.james.dev</newsgroup>
209          <newsgroup>org.apache.james.user</newsgroup>
210          <newsgroup>org.apache.avalon.dev</newsgroup>
211          <newsgroup>org.apache.avalon.user</newsgroup>
212       </newsgroups>
213 
214       <spool>
215          <configuration>
216             <spoolPath>file://var/nntp/spool</spoolPath>
217             <threadCount>1</threadCount>
218             <threadIdleTime>60000</threadIdleTime>
219          </configuration>
220       </spool>
221    </nntp-repository>
222 
223    <spoolrepository destinationURL="file://var/mail/spool/" type="SPOOL"/>
224    <mailstore>
225       <repositories>
226          <repository class="org.apache.james.mailrepository.AvalonMailRepository">
227             <protocols>
228                <protocol>file</protocol>
229             </protocols>
230             <types>
231                <type>MAIL</type>
232             </types>
233          </repository>
234          <repository class="org.apache.james.mailrepository.AvalonSpoolRepository">
235             <protocols>
236                <protocol>file</protocol>
237             </protocols>
238             <types>
239                <type>SPOOL</type>
240             </types>
241          </repository>
242 
243          <repository class="org.apache.james.mailrepository.JDBCMailRepository">
244             <protocols>
245                <protocol>db</protocol>
246             </protocols>
247             <types>
248                <type>MAIL</type>
249             </types>
250             <config>
251                <sqlFile>file://conf/sqlResources.xml</sqlFile>
252             </config>
253          </repository>
254 
255          <repository class="org.apache.james.mailrepository.JDBCSpoolRepository">
256             <protocols>
257                <protocol>db</protocol>
258             </protocols>
259             <types>
260                <type>SPOOL</type>
261             </types>
262             <config>
263                <sqlFile>file://conf/sqlResources.xml</sqlFile>
264                <maxcache>1000</maxcache>
265             </config>
266          </repository>
267 
268          <repository class="org.apache.james.mailrepository.JDBCMailRepository">
269             <protocols>
270                <protocol>dbfile</protocol>
271             </protocols>
272             <types>
273                <type>MAIL</type>
274             </types>
275             <config>
276                <sqlFile>file://conf/sqlResources.xml</sqlFile>
277                <filestore>file://var/dbmail</filestore>
278             </config>
279          </repository>
280 
281          <repository class="org.apache.james.mailrepository.JDBCSpoolRepository">
282             <protocols>
283                <protocol>dbfile</protocol>
284             </protocols>
285             <types>
286                <type>SPOOL</type>
287             </types>
288             <config>
289                <sqlFile>file://conf/sqlResources.xml</sqlFile>
290                <filestore>file://var/dbmail</filestore>
291                <maxcache>1000</maxcache>
292             </config>
293          </repository>
294 
295          <repository class="org.apache.james.mailrepository.MBoxMailRepository">
296             <protocols>
297                <protocol>mbox</protocol>
298             </protocols>
299             <types>
300                <type>MAIL</type>
301             </types>
302          </repository>
303 
304          <repository class="org.apache.james.mailrepository.filepair.File_Persistent_Object_Repository">
305             <protocols>
306                <protocol>file</protocol>
307             </protocols>
308             <types>
309                <type>OBJECT</type>
310             </types>
311             <models>
312                <model>SYNCHRONOUS</model>
313                <model>ASYNCHRONOUS</model>
314                <model>CACHE</model>
315             </models>
316          </repository>
317 
318          <repository class="org.apache.james.mailrepository.filepair.File_Persistent_Stream_Repository">
319             <protocols>
320                <protocol>file</protocol>
321             </protocols>
322             <types>
323                <type>STREAM</type>
324             </types>
325             <models>
326                <model>SYNCHRONOUS</model>
327                <model>ASYNCHRONOUS</model>
328                <model>CACHE</model>
329             </models>
330          </repository>
331       </repositories>
332 
333    </mailstore>
334 
335    <users-store>
336          
337       <repository name="LocalUsers" class="org.apache.james.userrepository.JamesUsersJdbcRepository" destinationURL="db://maildb/m_user">
338          <sqlFile>file://conf/sqlResources.xml</sqlFile>
339       </repository>
340    </users-store>
341 
342    <database-connections>   
343          <data-source name="maildb" class="org.apache.james.util.dbcp.JdbcDataSource">
344           <driver>oracle.jdbc.driver.OracleDriver</driver>
345           <dburl>jdbc:oracle:thin:@192.168.1.21:1521:***</dburl>
346           <user>***</user>
347           <password>***</password>
348           <max>20</max>
349      </data-source>
350 
351    </database-connections>
352 
353    <connections>
354       <idle-timeout>300000</idle-timeout>
355       <max-connections>30</max-connections>
356    </connections>
357 
358    <sockets>
359       <server-sockets>
360          <factory name="plain" class="org.apache.avalon.cornerstone.blocks.sockets.DefaultServerSocketFactory"/>
361       </server-sockets>
362       <client-sockets>
363          <factory name="plain" class="org.apache.avalon.cornerstone.blocks.sockets.DefaultSocketFactory"/>
364       </client-sockets>
365    </sockets>
366 
367    <thread-manager>
368       <thread-group>
369          <name>default</name>
370          <priority>5</priority>
371          <is-daemon>false</is-daemon>
372          <max-threads>100</max-threads>
373          <min-threads>20</min-threads>
374          <min-spare-threads>20</min-spare-threads>
375       </thread-group>
376    </thread-manager>
377 </config>
378 

评论

# re: Apache James 收发内外网邮件的配置[未登录]  回复  更多评论   

2009-05-05 15:37 by Jeffrey
HI,

请问当我加新的域名如何可以不用从新起动服务器?
当我用<authRequired>true</authRequired>, JAMES 不能发觉我的新域名.

谢谢

# re: Apache James 收发内外网邮件的配置  回复  更多评论   

2010-05-24 17:11 by LuckyZhang
如上配置,可以正常发送到外网,但是无法正常从外网接收。我环境是CentOS5.2+Jame2.3.2+Intouch2.1+MySql5.0
Intouch可以发送到外网,没有问题。但是outlook,Foxmail不可以发送。全部都不可以接收外网过来的邮件,会出pop异常。暂未解决,期待达人指点。
qq:4639966

# re: Apache James 收发内外网邮件的配置  回复  更多评论   

2012-11-06 13:48 by gxy
安装上面的配置,能发送到外网,但不能接受外网的邮件,比如163

# re: Apache James 收发内外网邮件的配置  回复  更多评论   

2012-11-29 10:29 by gxy
不能删除邮件,楼主有遇到过这个问题吗?

只有注册用户登录后才能发表评论。


网站导航: