Dear Wiki user, You have subscribed to a wiki page or wiki category on "James Wiki" for change notification.
The following page has been changed by VincenzoGianferrari: http://wiki.apache.org/james/HandlingExceptions ------------------------------------------------------------------------------ Prior to the James 2.2.0a5 test build, the Mail Administrator was unable to control exception management, and may need to, as the Administrator is the only person knowing if matching because of an exception is the correct application domain semantic. In 2.2.0a5 we added a mechanism (the "onException") that provides administrative control, optionally coding (the attribute values are case insensitive): {{{ - {{{ <mailet match="..." class="..." }}} + <mailet match="..." class="..." - {{{ [onMatchException="{noMatch|matchAll|error|<aProcessorName>}"] }}} + [onMatchException="{noMatch|matchAll|error|<aProcessorName>}"] - {{{ [onMailetException="{ignore|error|<aProcessorName>}"]> }}} + [onMailetException="{ignore|error|<aProcessorName>}"]> - }}} + }}} The meaning of the values is as follows: @@ -29, +29 @@ ---- '''An Example''' - An example taken from a system using the James 2.2.0a7 test build and it.praxis.james.jar 1.1.6/16) is the following: + An example taken from a system using the James 2.3.0 build is the following: {{{ - {{{ <!-- Check for viruses --> }}} - {{{ <mailet match='IsInfected="C:\Program Files\Common Files\Network Associates\VirusScan Engine\4.0.xx\scan" /analyze /noboot /nomem /noexpire /unzip /report %reportFile% %targetDir%\*.tt, D:\Viruscheck, false, 13' }}} - {{{ class="ToProcessor" onMatchException="noMatch"> }}} - {{{ <processor> virus </processor> }}} - {{{ </mailet> }}} - - {{{ <!-- Check attachment extensions for possible viruses --> }}} + <!-- Check attachment extensions for possible viruses --> + <!-- The "-z" option requests the check to be non-recursively applied --> + <!-- to the contents of any attached '*.zip' file. --> - {{{ <mailet match="AttachmentFileNameIs=*.exe,*.com,*.bat,*.pif,*.scr,*.vbs,*.eml,*.avi,*.mp3,*.mpeg,*.shs" }}} + <mailet match="AttachmentFileNameIs=-d -z *.exe *.com *.bat *.cmd *.pif *.scr *.vbs *.avi *.mp3 *.mpeg *.shs" - {{{ class="Bounce" onMatchException="noMatch"> }}} + class="Bounce" onMatchException="error"> - {{{ <inline>heads</inline> }}} + <inline>heads</inline> - {{{ <attachment>none</attachment> }}} + <attachment>none</attachment> - {{{ <passThrough>false</passThrough> }}} + <passThrough>false</passThrough> - {{{ <prefix>[REJECTED]</prefix> }}} + <prefix>[REJECTED]</prefix> - {{{ <notice> }}} + <notice> - The Security Policy of XYZ Corp. does not allow to forward messages containing attachments having any of the extensions .exe, .com, .bat, .pif, .scr, .vbs, .eml, .avi, .mp3, .mpeg, .shs, therefore your message has been rejected. + The Security Policy of XXX does not allow to forward messages containing attachments having any of the extensions .exe, .com, .bat, .cmd, .pif, .scr, .vbs, .avi, .mp3, .mpeg, .shs, therefore your message has been rejected. Please don't reply to this e-mail as it has been automatically sent by the antivirus system. - Regards, Postmaster xyz.com + Regards, Postmaster XXX.YYY - ----------------------------- + ..................................... - {{{ </notice> }}} + </notice> - {{{ </mailet> }}} + </mailet> - }}} + }}} - The onMatchException attributes were coded because some malformed messages, typical of viruses, are causing some javax methods to throw exceptions; my choice was to not match and continue, but it could be done differently, perhaps the first one using noMatch, and the second one sending to a special "may-contain-executables" processor, that bounces back a less "resolute" message. + The onMailetException attributes were coded because some malformed messages, typical of viruses, are causing some javax methods to throw exceptions; my choice was to consider the message in error, but it could be done differently, perhaps the first way using noMatch, and the second way sending the message to a special "may-contain-executables" processor, that bounces back a less "resolute" message. ---- '''Overview of Exception Handling in the Mailet Pipeline'''