You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Jason Tjankilisan <ja...@yahoo.com.INVALID> on 2019/07/04 03:34:18 UTC

About Custom Mailet Configuration

Hi

So I was reading this tutorial about creating your own custom Mailet https://james.apache.org/server/3/dev-extend-mailet.html, and from what i have read, Mailet is a component that process the mail that is going through the server and can output log whenever something happen with the Email. Im interested in trying this tutorial to understand better of mailet works.

So I follow the tutorial, but I had trouble understanding the tutorial from the lack imagery. Here’s what I’ve done so far
- Create a java file just like in the “Logging” and add Init , Destroy, getMailetInfo function as the “Configuration” said they must have that.
- Unzip the james-server-mailets-3.3.0.jar from james/lib to get the function.
- Put all on it in one place and use Ant Compile (I didn’t know anything about Apache Ant but my friend set it up for me and just to type ant when I want to compile) to build it and created the jar file from the custom mailet.
- Put the jar file into james/lib 
- Edit the log4j.properties as mention in the code : added this 
- # Experimental
- log4j.logger.com.test=INFO, CONS, FILE
- log4j.logger.com.test=DEBUG, CONS, FILE
- # ------------
- Edit the mailetcontainer.xml and comment out the one near that as last time I tried it, the connection refused when both of those are active.

<!-- Send remaining mails to the transport processor for either local or remote delivery -->
       <mailet match="All" class="com.test.CustomMeiletTestClassName"/>
<!--  
       <mailet match="All" class="ToProcessor">
	     <processor>transport</processor>  
       </mailet>
 -->

Some problem occur , the connection still refused and these error show up at log whenever I use my CustomMeiletTest:

INFO  14:31:16,495 | org.apache.james.mailetcontainer.lib.AbstractStateMailetProcessor | Mailet com.test.CustomMeiletTest instantiated.
WARN  14:31:16,515 | org.apache.james.container.spring.context.JamesServerApplicationContext | Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mailprocessor': Invocation of init method failed; nested exception is javax.mail.MessagingException: Unable to setup routing for MailetMatcherPairs;
  nested exception is:
    java.lang.NullPointerException

I attach the java code since writing it here gonna make the mail look so large. Can anyone help what did I do wrong or maybe misunderstand? 

Sorry for any wrong word, and thank you for the help.

Sincerely, Jason





Sent from Mail for Windows 10