1

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?

Andy Brunner
  • 133
  • 3
  • 12
  • 1
    It looks like the header value includes an encoded word as described in RFC2047 (e.g. `From: =?US-ASCII?Q?Keith_Moore?= `). Have you determined whether the value was like that in the original MIME message? Btw, here's RFC2047: https://www.ietf.org/rfc/rfc2047.txt – Dave Delay Mar 09 '19 at 16:06
  • What does the [JavaMail debug output](https://javaee.github.io/javamail/FAQ#debug) show when you access a message like this? – Bill Shannon Mar 10 '19 at 03:58
  • Which JavaMail version are you using? – Mark Rotteveel Mar 10 '19 at 11:48
  • It is the JavaMail which is installed with the IBM Domino 10.0.1 product: `Manifest-Version: 1.0 Implementation-Version: 1.4 Specification-Title: JavaMail(TM) API Design Specification Specification-Version: 1.3 Implementation-Title: javax.mail Extension-Name: javax.mail Created-By: 1.5.0 (Sun Microsystems Inc.) Implementation-Vendor-Id: com.sun Implementation-Vendor: Sun Microsystems, Inc. Specification-Vendor: Sun Microsystems, Inc. SCCS-ID: @(#)javamail.mf 1.6 05/12/09` – Andy Brunner Mar 10 '19 at 12:24

1 Answers1

1

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.

Dave Delay
  • 1,292
  • 8
  • 12
  • Thanks Dave! You pointed me to the right solution. In my program, the whole Domino body MIMEEntry is created by reading the MIME stream from the Java Mail API message.writeTo(). The problem was the way I retrieved the complete sender address e.g. "John Smith" `mailSenderAddressLong = mailFrom[0].toString()` After changing the code to `mailSenderAddressLong = mailFrom[0].toUnicodeString();` everything works fine. Thank you so much for your help! – Andy Brunner Mar 10 '19 at 18:23