javajakarta-maillotus-dominomimeibm-domino

Domino 10 sometime does not decode MIME headers under Java


I have a Java 1.8 program running on the Domino 10.0.1 server which reads POP3/IMAP MIME messages and creates a Notes MIME mail document from it.

Everything works fine, except that some (very few) messages do not convert the coded MIME headers. They are then shown in the Notes client in this ugly format.

From: =?utf-8?Q?Test=20Subject?= <anyname@acme.com>

I have set "UTF-8" on all possible places and disabled the MIME to rich-text conversion.

properties.setProperty("mail.mime.charset", "UTF-8");
...
boolean savedConversionFlag = dbGetSession().isConvertMime();
dbGetSession().setConvertMime(false);

What could cause this?


Solution

  • I just tried an experiment. I sent an email with Chinese characters in the subject from my Gmail account to my Notes inbox. Domino stored the Subject as an RFC822 text item like this:

    Subject: =?UTF-8?B?5oiR6IO95ZCe5LiL546755KD6ICM5LiN5Lyk6Lqr5L2T44CC?=
    

    When I view the message in Notes, it displays the Chinese characters correctly.

    Based on my experiment and your comments, I think you are storing the encoded string in a plain text item -- not RFC822 text. The difference is subtle, but you can verify this by looking at the document properties in Notes. If you are storing the value in a plain text item, Notes doesn't know it should decode it.

    So, I think you have two choices to make this work in Notes:

    1. Store the item in plain text as you are currently doing, but decode the string first. I assume JavaMail is able to help with the decoding step.

    2. Leave the value encoded, but store it as an RFC822 text item. This is what the Domino router does.

    Since I'm not 100% sure how to do #2 with the Notes Java classes, I would probably start with the first option.