I am accessing Lotus and Groupwise using javamail via IMAP, recursively accessing all folders and processing email I find. But in folders like Tasklist and Calendar (those are from Groupwise but I think I remember Lotus had similar things), I get the items in there as instances of IMAPMessage, and so they are processed as if they were mail.
I understand those items get exposed as mail through the IMAP protocol (either by design or by mistake), but I only want to process proper mail. Is there a way to do this? I have dismissed following approaches so far:
What I am looking is some IMAP api call I have missed so far or something in those lines...
I'm not familiar with javamail, but I am familiar with the IMAP protocol (RFC 3501) and I would try following approaches:
Sample IMAP command:
TAG0001 FETCH 1 BODY.PEEK[HEADER.FIELDS (CONTENT-TYPE)]
Sample IMAP server response:
* 1 FETCH (BODY[HEADER.FIELDS (CONTENT-TYPE)] {69}...data..})
TAG0001 OK Success
The content of "...data..." is the Content-type header:
Content-Type: text/calendar;
name="meeting.ics";
method=REQUEST
Sample IMAP command:
TAG0002 FETCH 2 (BODY)
Sample IMAP server response:
* 1 FETCH (
BODY
(
(
("text" "plain" ("charset" "iso-8859-2") NIL NIL "quoted-printable" 194 1)
("text" "html" ("charset" "iso-8859-2") NIL NIL "quoted-printable" 1173 1)
("text" "calendar"
("name" "meeting.ics" "charset" "windows-1252" "method" "REQUEST") NIL NIL "8bit" 1531 1)
"alternative"
)
"mixed"
)
)
TAG0002 OK FETCH completed.
(lots of whitespaces added for better readability)
Check out sections 6.4.5 and 7.4.2 of RFC 3501 for more information about the FETCH command and its response format. I don't know how to achieve this using javamail, unfortunately.