Hi,
I'm trying to use commons-net-3.1 to fetch body[header] and body[text] via IMAP.
When I try to use the fetch command I get a MalformedServerReplyException.
The stack trace I get is:
Exception in thread "main"
org.apache.commons.net.MalformedServerReplyException: Received
unexpected IMAP protocol response from server: 'Return-Path:
<[removed]>'.
at org.apache.commons.net.imap.IMAPReply.getReplyCode(IMAPReply.java:128)
at org.apache.commons.net.imap.IMAPReply.getReplyCode(IMAPReply.java:93)
at org.apache.commons.net.imap.IMAP.__getReply(IMAP.java:120)
at org.apache.commons.net.imap.IMAP.__getReply(IMAP.java:90)
at org.apache.commons.net.imap.IMAP.sendCommandWithID(IMAP.java:225)
at org.apache.commons.net.imap.IMAP.sendCommand(IMAP.java:238)
at org.apache.commons.net.imap.IMAP.sendCommand(IMAP.java:263)
at org.apache.commons.net.imap.IMAP.doCommand(IMAP.java:276)
at org.apache.commons.net.imap.IMAPClient.fetch(IMAPClient.java:339)
A sample that reproduces the problem is:
public static void main(String[] args) throws Exception {
IMAPClient client = new IMAPClient();
client.connect(SERVER);
client.login(USERNAME, PASSWORD);
client.select("INBOX");
client.fetch("1", "body[header]");
}
When I telnet to the IMAP server I get a response like:
08 fetch 1 body[header]
* 1 FETCH (BODY[HEADER] {608}
Return-Path: <____@____.com>
X-Original-To: ____@____.com
[...]
)
* 79690 EXISTS
* 13 RECENT
08 OK Fetch completed.
I have checked out the samples but they only seem to list emails and
never fetch body[header] or body[text].
Am I using the fetch command correctly?
Can anyone point me in the right direction?
Thanks
--
Dimitri
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]