commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: [net] Problem using IMAPClient to fetch email contents
Date Sat, 26 May 2012 12:22:09 GMT
On 25 May 2012 16:17, sebb <sebbaz@gmail.com> wrote:
> On 25 May 2012 03:24, sebb <sebbaz@gmail.com> wrote:
>> On 24 May 2012 01:28, Dimitri Koussa <dimitri.koussa@gmail.com> wrote:
>>> 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?
>>
>> Yes.
>>
>>> Can anyone point me in the right direction?
>>
>> Looks like there is a bug in the way server replies are handled.
>> The code is not processing the string response correctly.
>>
>> It should see the {608} at the end of the line and read the next 608
>> octets as a string, but it does not.
>
> https://issues.apache.org/jira/browse/NET-467
>
> has been created to track this issue.

Now hopefully solved.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message