james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ted Watson" <twat...@mindbridge.com>
Subject Problem bouncing email to sender
Date Thu, 16 Sep 2004 17:30:13 GMT

I'm trying to write a mailet to bounce mail back to the sender in the event that an email
is received for an unknown user on my host.  This is my service function, which works except
for the bounce:

    public void service(Mail mail) throws MessagingException
    {
            mc=getMailetContext();
            Collection recipients=mail.getRecipients();
            Iterator it = recipients.iterator();
  
            MailAddress testAddr = null;       
            while(it.hasNext())
            {
                testAddr = (MailAddress)it.next();
                if(!mc.isLocalUser(testAddr.getUser()))
               {
                System.out.println("Bad Local User Found, notifying sender");
                mc.bounce(mail,"Returned Mail");
               }
           }
   } 

The config file has the line:

<mailet match="All" class "BounceIt"/>

Why won't this bounce anything back to the sender?  Thanks.
Mime
View raw message