Skip to main content

Legal Message-ID format or bug?

  3 posts   Feedicon  
Replies: 2 - Last Post: November 23, 2013 20:04
by: dm222
showing 1 - 3 of 3
Posted: November 23, 2013 00:18 by dm222
I have a message with a Message-ID that the JavaMail 1.5.1 IMAP ENVELOPE class won't parse.

The Message-ID was created in my test by JavaMail 1.5.1 UniqueValue.getUniqueMessageIDValue() method automatically when I sent the test message. The user.name on our company laptops has a backslash in it. So, the test message's Message-ID is generated like this - note the quote positions and backslashes:

<200539426.0.1385163251116.JavaMail."COMPANY\\My.Name"@hostvalue>

My first question: Is this a legally formatted message ID?

If it is legal, then it appears that there is a bug in ENVELOPE.parseString(). When fetching and reading this message ID from my test IMAP server (on JavaMail 1.5.1), the ENVELOPE.parseString() method reads only up to the first quote character and stops and returns that. The subsequent code in ENVELOPE's constructor, at line 110, expects to see the final ")" and does not because parseString() terminated prematurely, and therefore throws a ParsingException.

If this Message-ID is not legal, then it appears there is a bug in UniqueValue.getUniqueMessageIDValue() that does not properly quote/escape a Message-ID that has a user.name system property that includes characters requiring escaping.

Or have I simply missed some basic understanding?
Posted: November 23, 2013 07:13 by Bill Shannon
That's a legal Message-ID.

What is the exact message returned by the server?

The Message-ID would be returned in the IMAP protocol message as a quoted string, which means the server would need to escape the quotes in the Message-ID string. If the server doesn't do that correctly, JavaMail won't be able to parse the message correctly.

What IMAP server are you using?
Posted: November 23, 2013 20:04 by dm222
Thanks, I see the problem now. I am using the GreenMail 1.3.1b test server.

I missed the fact the added quotes required the inner quotes to be escaped. Pretty sure this is a GreenMail server bug as I stepped through its response handling code.
Replies: 2 - Last Post: November 23, 2013 20:04
by: dm222
 
 
Close
loading
Please Confirm
Close