James java mail server java mailet that does email conversion to another text and/or to a SIP object

Pablo Pita authored on 29 Jan 2017
src Extract some data from mail 2 years ago
.gitignore Draft requirements for mailet 2 years ago
README.md git workaround 2 years ago
pom.xml Extract some data from mail 2 years ago


Java Mailet for the James mail server that does email conversion to another text and/or to a SIP object.

Build from source

Use git to retrieve the sources. There is an issue with nginx certificates that needs a work around:

 git  -c http.sslVerify=false clone http://gitbucket.pitagoral.com/git/pablo/text2sip.git
 git config http.sslVerify false
 mvn package


The Apache James java mail server gets an email to be processed as SIP data. The root processor in the mailetcontainer.xml file has an entry that detects the emails by matching whatever the user specifies from the emails (for example, the sender), and sends those to the text2sip processor as shown here:

 <processor state="root">
   <mailet match="RecipientIs=text2sip@xxx.yyy" class="ToProcessor">
 </processor >

In the text2sip processor, there are some checks and conversions, like getting only text, and then, the Text2SipFeeder does the bulk job.

   <!-- This processor converts text to sip and sends it to an asterix server -->
   <processor state="text2sip" enableJmx="true">
       <mailet match="All" class="OnlyText" />
       <mailet match="RecipientIs=text2sip@xxx.yyy" class="com.smartgart.mailet.Text2SipFeeder">

Text2SipFeeder extracts the textual payload from the email (from, to, date, subject, text and also a mapping from email-to (address) to SIP-to (number)) (TBC: where does it come from). Then, if OK, it feeds the new message to Asterisk's gateway interface.

It is also possible to do a text to SIP conversion in java. The generated SIP object would then be passed to Asterisk.