361 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Pods | Blogs | Search | myPL | About 
 
Latest 7 Posts
Poking around the iNotes HTTP API (Part 1)
Mon, Nov 24th 2014 70
Flashcards - German Version: Die Lernkartei
Sun, Nov 23rd 2014 99
Last usage of a mail file - for all users
Fri, Nov 21st 2014 215
Providing user information in JSON
Thu, Nov 20th 2014 144
Building a shared approval frontend in XPages
Sun, Nov 16th 2014 221
Mustache Helper for Domino
Sun, Nov 16th 2014 213
Karma and Wealth
Sat, Nov 15th 2014 145
Top 10
Domino Development - Back to Basics - Part 5: Finding data - Collections and Search
Thu, Jan 2nd 2014 408
A peek in my JavaScript Toolbox
Fri, Nov 14th 2014 251
Custom REST service in XPages using a service bean
Wed, Oct 22nd 2014 232
Building a shared approval frontend in XPages
Sun, Nov 16th 2014 221
Last usage of a mail file - for all users
Fri, Nov 21st 2014 215
Mustache Helper for Domino
Sun, Nov 16th 2014 213
Dear SingTel, please fix your routing performance!
Wed, Apr 24th 2013 173
Karma and Wealth
Sat, Nov 15th 2014 145
Providing user information in JSON
Thu, Nov 20th 2014 144
Custom experience for IBM Connections Cloud - Project Muse
Wed, Nov 12th 2014 141


Importing EML files into Notes (lots of them)
Stephan H Wissel    

My friend and Lotus Champion Weerapong Panpai from Zenith in Thailand asked me "How difficult is it to do a bulk import of eml files into Lotus Notes"? MIME as a format is plain ASCII, so on first look it seems simple.
However on a closer look you might guess where the author of an outstanding movie got his inspiration from. RFC 2045 nicely states:"NOTE: The previous four definitions are clearly circular. This is unavoidable, since the overall structure of a MIME message is indeed recursive." So trying to parse that messages on my own was clearly out of the question. Luckily there is ready code available. On one side there is JavaEE and the the MimeMessage and on the other Apache James. An implementation of the javax.mail.internet classes is hidden somewhere in the Notes client, so that would favour MimeMessage. However I found it easier to work with the mime4j classes. Here is what I came up with:
package com.notessensei.mimeimport;

import java.io.IOException;
import java.io.InputStream;

import lotus.domino.Document;
import lotus.domino.NotesException;
import lotus.domino.Session;

import org.apache.james.mime4j.MimeException;
import org.apache.james.mime4j.parser.ContentHandler;
import org.apache.james.mime4j.parser.MimeStreamParser;


public class Mime2Doc {
   
    public void importMail(Session s, InputStream in, Document doc) throws NotesException, MimeException, IOException {
        doc.replaceItemValue("Form", "Memo");
        MimeStreamParser parser = new MimeStreamParser();
        ContentHandler h = new DocContentHandler(s, doc);
        parser.setContentHandler(h);
        parser.parse(in);
    }
}
The bulk of the work happens inside the ContentHandler. Using a Stack (that works LIFO) I can track Mime entries inside mime entries inside mime entries. Still the code is just below 100 lines.
The final piece in the puzzle is the class that helps to track the MIME Parts that are put onto the Stack and returns MIME-Type and encoding derived from the header fields. You are ready to test.

---------------------
http://feedproxy.google.com/~r/Wisselnet/~3/Go4nOK0XYws/SHWL-8TMJFU
Apr 23, 2012
44 hits



Recent Blog Posts
70


Poking around the iNotes HTTP API (Part 1)
Mon, Nov 24th 2014 11:12a   Stephan H Wissel
With the rise of web applications, something interesting happened: applications gained an observable API. Delivered over HTTP(s) with a few commands (GET, POST etc.) it became easier to find out "what is going on". Tools like Wireshark, Fiddler, Charlesproxy or TCPMon sit between your HTTP consuming client and the HTTP generating server. In browser applications the build in developer tools (Ctrl-Shift-I) provide the same level of access. So anything flowing over HTTP is effectively an API. Th [read] Keywords: ibm inotes ldd lotus notes applications google server twitter
99


Flashcards - German Version: Die Lernkartei
Sun, Nov 23rd 2014 6:12a   Stephan H Wissel
The offspring and SWMBO had an argument about the need for Chinese tuition when attending Singapore's oldest school. You can guess who had what position. Disecting the positions and looking at interest (you remember your basic negotiation skills, do you?) it boiled down to the wish of self directed learning vs. fear of failure. Having gone through both (I remember my Latin tuition teacher well. I loathed him and in return he pushed me within 6 month from F to A), I concluded: self direction ne [read] Keywords: application google wiki
215


Last usage of a mail file - for all users
Fri, Nov 21st 2014 8:18a   Stephan H Wissel
My admin is getting a little rusty. When I was asked: "How can I indentify a dormant mailbox?" I couldn't name a place in admin where to look. Of course, there is the NotesDatabase.LastModified property, but that would get updated on a design refresh too. So I asked innocently: "dormant, how?" After an amusing 2 hour discussion between the stake holders (only the popcorn was missing) we concluded that it is either No document has been created for a while (including incoming) No email has [read] Keywords: admin ibm lotusscript notes email
144


Providing user information in JSON
Thu, Nov 20th 2014 5:12a   Stephan H Wissel
In the MUSE project we encountered the need to retrieve user information in JSON format. Easy done one would think. The trouble starts, when you have multiple directories and you need reasonable speed. Sometimes falling back to @Fomulas gives you what you need, fast and easy. @NameLookup knows where to look and you don't need any extra configuration. A simple call to an form will give you all you need: https://yourserver/somedb.nsf/namelookup?Readform for yourself or add &User=John Doe for [read] Keywords: domino dxl ibm email
221


Building a shared approval frontend in XPages
Sun, Nov 16th 2014 8:18p   Stephan H Wissel
The saying goes: "God would not have been able to create the world in 7 days, if there would have been an installed base to take care of". As much as we wish to have divine powers, we need to make with less and look after an installed base. Point in case: You have a set of approval applications in classic Notes client code, like: Travel, Leave, Expenses, Gifts, Training, BoM changes etc. You are challenged to provide a web and/or mobile interface for them. Considering your options you have to [read] Keywords: lotusscript notes notes client policies xpages application applications development interface java mobile wiki
213


Mustache Helper for Domino
Sun, Nov 16th 2014 10:18a   Stephan H Wissel
Previously we had a look, how to use Mustache with the CKEditor to have an editing environment for templates. I glossed over the part where to store and how to use these templates. Let me continue there. I'll store the template in Notes documents and use an application managed bean to transform a document (and later other things) using these templates. I have 2 use cases in mind: one is to allow the configuration of HTML notification messages in applications and the other to configure the dis [read] Keywords: agent domino ibm notes xpages application applications database java xml
145


Karma and Wealth
Sat, Nov 15th 2014 11:19p   Stephan H Wissel
Karma has gotten some attention lately, while I muse it for some time. The common short explanation is "What goes around comes around" or in other words: "Every action (or inaction) you take has consequences, you ultimately will be confronted with". We are reminded by various spiritual traditions , that nothing good can come from a bad deed and that good deeds will yield (in mysterious ways, somewhen) good results. This is where the trouble starts. Our and the mystic perceptions what is "g [read] Keywords: wiki




251


A peek in my JavaScript Toolbox
Fri, Nov 14th 2014 5:19a   Stephan H Wissel
Every craftsman has a toolbox, except developers: we have many. For every type of challenge we use a different box. Here's a peek into my web front-end programming collection. It works with any of your favorite backends. In no specific order: AngularJS one of the popular data binding frameworks, created by Google engineers. With a focus on extensibility, testability and clear seperation of concerns it allows to build clean MVC style applications Data Driven Documents short: D3JS. If anything n [read] Keywords: ibm application applications community database eclipse google integration javascript server twitter wiki
141


Custom experience for IBM Connections Cloud - Project Muse
Wed, Nov 12th 2014 8:19a   Stephan H Wissel
The old saying goes: "You can't have your cake and eat it too". When organisations move computing from servers they control into a SaaS (the artist formerly known as ASP) environment, they swap customisability for configurability and standardisation. The idea is, that a vendor controlled cloud environment benefits from both the economy of scale as well as the frequent updates the claimed DevOps model brings. But you can have both. One of IBM's best secret are the assets that the IBM Softwar [read] Keywords: atlas collaboration connections ibm lotus application linkedin twitter wiki xml
114


LifeBEAM helmet first impressions
Wed, Nov 5th 2014 10:12a   Stephan H Wissel
After quite a wait (they were sold out) my LifeBEAM helmet arrived today. The helmet is based on a Lazer design. Here are my unpacking impressions: There are no experiments on the box. Black always has been the new black. [read] Keywords:




Created and Maintained by Yancy Lent - About - Blog Submission - Suggestions - Change Log - Blog Widget - Advertising - Mobile Edition