Ok I got things to work with the bouncing.

[
   While this is truly just a detail, if all the of the source was in one 
place, it would have been much easier to fix and thought-trace.
  I spend 80% of the time in james just trying to find where some file is.  
Maven is def a tradeoff. 
  Anyhow.  To each his own I suppose.
]


a few notes if anyone attempts this:

1.  make sure post master is a user.
2.  make sure that the relay-denied hosts are sufficient (i'm 127.0.1.1 not 
127.0.0.1, sometimes james seems to pick up the actual host name, instead of a 
number, but it's random)
3.  the ToSenderFolder xml frag seems to be incorrect.


this might be of use to someone.  this matching of many recipients troubles me 
though.
will it store it once for each recipient?  I don't know

(sorry about formatting, I can't stand spaces and my tabs are 4, don't know 
what will come through.


/****************************************************************
 * Licensed to the Apache Software Foundation (ASF) under one   *
 * or more contributor license agreements.  See the NOTICE file *
 * distributed with this work for additional information        *
 * regarding copyright ownership.  The ASF licenses this file   *
 * to you under the Apache License, Version 2.0 (the            *
 * "License"); you may not use this file except in compliance   *
 * with the License.  You may obtain a copy of the License at   *
 *                                                              *
 *   http://www.apache.org/licenses/LICENSE-2.0                 *
 *                                                              *
 * Unless required by applicable law or agreed to in writing,   *
 * software distributed under the License is distributed on an  *
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
 * KIND, either express or implied.  See the License for the    *
 * specific language governing permissions and limitations      *
 * under the License.                                           *
 ****************************************************************/

package org.apache.james.transport.matchers;

import org.apache.mailet.Mail;
import org.apache.mailet.MailAddress;
import org.apache.mailet.base.GenericMatcher;
import org.apache.mailet.MailetContext;

import java.util.Collection;

public class SenderIsLocal extends GenericMatcher {

    public Collection match(Mail mail) {
        if (mail.getSender() == null) {
            return null;
        }

        MailetContext mailetContext = getMailetContext();

        if (mailetContext.isLocalUser(mail.getSender().toString()))
                return mail.getRecipients();

        return null;
    }
}





On Jul 1, 2012, at 5:18 PM, Timothy Prepscius wrote:

> Hello,
> 
> 
>           <!-- Place a copy in the user Sent folder -->
>           <mailet match="RecipientIsLocal" class="ToSenderFolder">
>               <folder>Sent</folder>
>               <consume>false</consume> 
>           </mailet>    
> 
> 
> shouldn't this be this:
> 
> 
>           <!-- Place a copy in the user Sent folder -->
>           <mailet match="SenderIsLocal" class="ToSenderFolder">
>               <folder>Sent</folder>
>               <consume>false</consume> 
>           </mailet>    
> 
> 
> ?
> 
> 
> On Jun 27, 2012, at 4:42 AM, Eric Charles wrote:
> 
>> Hi Tim,
>> 
>> I just have read your mail and may be late to help...
>> 
>> Anyway, you should add in the error process the Bounce mailet as first step
>> <mailet match="All" class="Bounce"/>
>> 
>> See [1] for example.
>> 
>> Thx, Eric
>> 
>> [1] 
>> https://svn.apache.org/repos/asf/james/app/trunk/src/main/resources/mailetcontainer-template.conf
>> 
>> On 06/27/2012 12:24 AM, Timothy Prepscius wrote:
>>> Hey there,
>>> 
>>> I thought I would ask before spending tonight researching.
>>> Is there an "easy" way to trigger a bounce from the the Mail storage step?
>>> 
>>> 
>>> For instance, mail has arrived for user Z, but now I notice that I can't 
>>> write it.  I want to bounce it back to the sender as undeliverable.
>>> 
>>> If I throw a Mailbox exception, then the mail gets stuck in var/error.
>>> 
>>> Any hints before I get started?
>>> 
>>> 
>>> 
>>> I'll spend tonight/tomorrow looking.
>>> 
>>> -tim
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
>>> For additional commands, e-mail: server-user-h...@james.apache.org
>>> 
>> 
>> -- 
>> eric | http://about.echarles.net | @echarles
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
>> For additional commands, e-mail: server-user-h...@james.apache.org
>> 
> 

Reply via email to