Hi Bernd,Thank you very much for your response. I'm doing something wrong, 
because I did as stated in your latest response and the DSNBounce.service gets 
called twice and no bounce is sent.
My (reduced) config is as follows:<spoolmanager>    <processor name="root">
            <mailet match="All" class="PostmasterAlias"/>            <mailet 
match="RelayLimit=30" class="Null"/>            <mailet 
match="RemoteAddrNotInNetwork=127.0.0.*,192.168.0.*,192.168.1.*" 
class="ToProcessor">                <processor>bounces</processor>              
  <notice>550 - Requested action not taken: relaying denied</notice>            
</mailet>            <mailet match="All" class="MyMailet" 
onMailetException="bounces">                
<bounceProcessor>bounces</bounceProcessor>             </mailet>        
</processor>        <processor name="bounces">            <mailet match="All" 
class="DSNBounce">                <sender>[email protected]</sender>           
     <attachment>message</attachment>                <messageString>Your 
message could not be processed, please try again</messageString>                
<prefix>NOT PROCESSED: </prefix>                
<passThrough>false</passThrough>                <debug>true</debug>            
</mailet>        </processor>        <processor name="transport">            
<mailet match="All" class="RemoteDelivery">                ....                
....                ....                <gateway>smtp.domain.com</gateway>      
          <gatewayPort>25</gatewayPort>                <debug>true</debug>      
      </mailet>        </processor>    </spoolmanager>
Sorry to bother you again.
Greetings,Navid
> From: [email protected]
> To: [email protected]
> Subject: AW: AW: James 2.3.1 config for bounces [unsigned]
> Date: Fri, 6 May 2016 07:19:12 +0000
> 
> Hi Navid
> 
> I assume the first processor is the "transport" processor.
> Ok, for example:
> if you get a "new incoming mail", which should result in a bounce:
> 
> 1. The "new incoming mail" will enter the transport processor.
> Cause it matches your "All" matcher, it will call your "MyMailet" class.
> 2. It will create a "bounce" inside your MyMailet class (why ever).
> What to do on a "bounce" is defined in the "bounces" processor.
> 3. Your "new incoming Mail" will then enter the "bounces" processor.
> Cause it matches your "All" matcher, it will call the "DSNBounce" class.
> The DSNBounce class will create a "new bounce mail".
> a. If you set "passthrough" to false, the "new incoming mail" will get the 
> state "GHOST".
> This means, this mail will be deleted. It will not be handled any further by 
> following mailets.
> b. If you set "passthrough" to true, the "new incoming mail" will go through 
> further mailets.
> So the "new incoming mail" (passthrough=true) will enter the next mailet.
> Cause it matches your "All" matcher, it will call the "RemoteDelivery" class.
> 4. The RemoteDelivery will always end the mail rules, so after that no 
> further mailets will be called with the "new incoming mail".
> 
> 5. The newly created "bounce mail" will then enter the transport processor.
> Cause it matches your "All" matcher, it should call your "MyMailet" class.
> If it does not create a bounce, it will not enter the bounces processor.
> 
> Btw. 
> The RemoteDelivery does not support "passThrough" as an option.
> It sets the state always to "GHOST" after spooling it.
> 
> 
> Greetings
> Bernd
> 
> -----Ursprüngliche Nachricht-----
> Von: Navid Allahverdi [mailto:[email protected]] 
> Gesendet: Mittwoch, 4. Mai 2016 17:54
> An: James Users List <[email protected]>
> Betreff: RE: AW: James 2.3.1 config for bounces [unsigned]
> 
> 
> 
> 
> 
> 
> 
> Hi Bernd,Thank you for your response. I have it partially working. If I set 
> the "passThrough" to true for "DSNBounce" mailet then de "RemoteDelivery" 
> mailet is accessed and the original message is sent instead of the bounce 
> message and the original message as attachment (as I would expect).If I set 
> the "passThrough" to false, then nothing happens and "RemoteDelivery" mailet 
> is not accessed.
> Do you know what is wrong with my configuration?
> --------------      <processor .....
> 
>             <mailet match="All" class="MyMailet" onMailetException="bounces"> 
>                <bounceProcessor>bounces</bounceProcessor>             
> </mailet>        </processor>        <processor name="bounces">            
> <mailet match="All" class="DSNBounce">                
> <sender>[email protected]</sender>                
> <attachment>message</attachment>                <messageString>Your message 
> could not be processed, please try again</messageString>                
> <prefix>NOT PROCESSED: </prefix>                
> <passThrough>false</passThrough>                <debug>true</debug>           
>  </mailet>            <mailet match="All" class="RemoteDelivery">             
>    <outgoing>file://var/mail/outgoing/</outgoing>                <!-- 
> Delivery Schedule based upon RFC 2821, 4.5.4.1 -->                <!-- 5 day 
> retry period, with 4 attempts in the first                hour, two more 
> within the first 6 hours, and then                every 6 hours for the rest 
> of the period. -->                <delayTime>10 minutes</delayTime>           
>      <maxRetries>5</maxRetries>
>                 <!-- The number of threads that should be trying to deliver 
> outgoing messages -->                <deliveryThreads>1</deliveryThreads>
>                 <!-- If false the message will not be sent to given server if 
> any recipients fail -->                <sendpartial>true</sendpartial>        
>         <bounceProcessor>bounces</bounceProcessor>                <!-- A 
> single mail server to deliver all outgoing messages. -->                <!-- 
> This is useful if this server is a backup or failover machine, -->            
>     <!-- or if you want all messages to be routed through a particular mail 
> server, -->                <!-- regardless of the email addresses specified 
> in the message -->                <!-- -->                <!-- The gateway 
> element specifies the gateway SMTP server name. -->                <!-- If 
> your gateway mail server is listening on a port other than 25, -->            
>     <!-- you can set James to connect to it on that port using the 
> gatewayPort -->                <!-- element. -->                <!-- Although 
> normally multiple addresses are implemented through proper -->                
> <!-- DNS configuration, the RemoteDelivery mail does allow specifying -->     
>            <!-- multiple gateway elements, each of which may also have a port 
> -->                <!-- e.g., mygateway:2525 -->                <!-- the 
> gatewayPort element is used as a default -->                
> <gateway>smtp-server.domain.com</gateway>                
> <gatewayPort>25</gatewayPort>                <!-- If the gateway requires 
> smtp authentication the following directives -->                <!-- 
> (gatewayusername/gatewayPassword) can be used. -->                <!--        
>         <gatewayusername>login</gatewayusername>                
> <gatewayPassword>pass</gatewayPassword>                -->                
> <passThrough>false</passThrough>                <debug>true</debug>           
>  </mailet>        </processor>
> -------------------------
> I could not find any information on how to use markup for nice layout of this 
> message, and hope you can read it.
> Thank you in advance,
> Navid
> 
> > From: [email protected]
> > To: [email protected]
> > Subject: AW: James 2.3.1 config for bounces [unsigned]
> > Date: Wed, 4 May 2016 10:04:34 +0000
> > 
> > Hello Navid,
> > 
> > yes.
> > 
> > In your outgoing mailet 
> >     <mailet match="All" class="RemoteDelivery">
> > you configure a bounce processor:
> >     <!-- By default we send bounces to the "bounce" processor -->
> >     <!-- By removing this configuration James will fall back to hardcoded 
> > bounce -->
> >     <!-- notifications -->
> >     <bounceProcessor>bounces</bounceProcessor>
> >     .... skipped the rest here ....
> >     </mailet>
> > 
> > Then you configure this bounces processor, here the default:
> >       <!-- This processor handle the bounces from RemoteDelivery: As of 
> > James v2.3, this is the new -->
> >       <!-- Default. -->
> >       <!-- DSNBounce properly create a DSN compliant bounce -->
> >       <processor name="bounces">
> >          <mailet match="All" class="DSNBounce">
> >             <passThrough>false</passThrough>
> >             <!-- optional subject prefix prepended to the original message 
> > -->
> >             <!--
> >             <prefix>[bounce]</prefix>
> >             -->
> >             <!-- message, heads or none, default=message -->
> >             <!--
> >             <attachment>heads</attachment>
> >             -->
> >             <!-- the message sent in the bounce, the first occurrence of 
> > the pattern [machine] is -->
> >             <!-- replaced with the name of the executing machine -->
> >             <!-- Default: Hi. This is the James mail server at [machine] 
> > ... -->
> >             <!--
> >             <messageString>Here is [machine]. I'm not able to deliver this 
> > message.</messageString>
> >             -->
> >             <messageString>Hi, this is the mail server at 
> > MyDomainOrWhatever.
> > I'm afraid I wasn't able to deliver your message to the following addresses.
> > This is a permanent error; I've given up. Sorry it didn't work out. Below
> > I include the list of recipients and the reason why I was unable to deliver
> > your message.
> > </messageString>
> >           </mailet>
> >       </processor>
> >    </spoolmanager>
> > 
> > You should be aware that a "DSNBounce" is different from "Bounce".
> > There is a "Bounce" mailet, and a "DSNBounce" mailet. They could be used to 
> > push a "bounce", but they behave differently.
> > 
> > I am not sure, but I think this is the way it could be handled:
> > The DSNBounce constructs a new mail. This new Mail object will "enter" the 
> > James mail process.
> > That means, you could act on this new DSNBounce-Mail, and route the new 
> > DSNBounce-Mail to another "RemoteDelivery".
> > You need to use a matcher like "HasHeader".
> > 
> > As code reference:
> > @see: org.apache.james.transport.mailets.DSNBounce.java
> > 
> > 
> > Greetings
> > Bernd
> > 
> > -----Ursprüngliche Nachricht-----
> > Von: Navid Allahverdi [mailto:[email protected]] 
> > Gesendet: Dienstag, 3. Mai 2016 18:01
> > An: [email protected]
> > Betreff: James 2.3.1 config for bounces
> > 
> > Hi all,We are using James 2.3.1 and have a problem configuring bounces.We 
> > would like the bounces to be sent through another mail-relay that the one 
> > the original message came through.
> > Is that possible?
> > Thank you in advance,Navid                                                  
> >                           
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> > 
> 
> 
>                                         
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
                                          

Reply via email to