Avatar billede avnes Nybegynder
15. marts 2006 - 15:49 Der er 1 kommentar

Problem med Apache James Mailet API

På engelsk fordi jeg har postet dette spørgsmål flere steder:

I am having a bit of problems with the Apache James Mailet API. To illustrate the
problem I have written a small Hello World mailet:

package org.apache.james.transport.mailets;

import javax.mail.MessagingException;
import org.apache.mailet.GenericMailet;
import org.apache.mailet.Mail;

public class HelloWorld extends GenericMailet {

    public void service(Mail mail) throws MessagingException {
        log ("HelloWorld's service(Mail)");
    }
   
    public String getMailetInfo() {
        return "HelloWorld Mailet";
    }
}

This was compiled and put in a jar file called SMSGatewayMailet.jar
which I put in James's lib directory together with mailet_1_0.jar,
mail-1.3.1.jar and james.jar (the three libs which was extracted from james.sar
as suggested by the James documentation).


Within the  <processor name="root"> context of config.xml I have added
the following:

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

I disbaled POP3 and NNTP and then started James, and start sending emails through
it's SMTP interface. When I look at the James' logfiles I can see that
the HelloWorld mailet was successfully instanciated, but the line
"HelloWorld's service(Mail)" is never written to any of the James' logfiles,
which must mean that the HelloWorld's service method is never loaded.

So maybe I have registered is incorrectly in config.xml ? Frankly I don't
think so as I used the Null mailet as example.

Any good ideas on how I can get my HelloWorld mailet to work ?
Avatar billede lborupj Nybegynder
19. marts 2006 - 12:18 #1
Hi,

I've used James in a somewhat large installation, and I just love
the simplicity of James.. Ofcoz you probably shouldn't use James as
an enterprise mail-server for a larger corporation, but still, its
stable and mature...

well - anyways, I guess your problem could be caused if you add your
mailet to the end of the other mailets under the root processor. The
incoming mail might already have been routed to other processors before
your mailed is "hit"... Is it the very first mailet?
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester