RE: [EXT] Re: Java Mail API Sort

2020-05-14 Thread Sean McElroy
If it's not a James issue then it must be a JavaMail API issue, but I suspect 
that this is not the case.

I will try jwma and get back to you.

Thanks.
-Original Message-
From: David Matthews 
Sent: Thursday 14 May 2020 10:36
To: James Users List 
Subject: RE: [EXT] Re: Java Mail API Sort

hi Sean

Is this even a James issue?

The jwma webmail program offers sorting of email either oldest first (which is 
javamail default), newest first or by sender. It's agnostic of the particular 
imap server and runs the same with james or dovecot.

Don't remember how it does this, but source code is available and I think it's 
fairly readable :-)

--
David Matthews
m...@dmatthews.org


-
To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
For additional commands, e-mail: server-user-h...@james.apache.org

Confidential Communication: The contents of this e-mail including any 
attachment are confidential and intended solely for the person(s) to whom they 
are addressed. Any reader of this email who is not the intended recipient is 
notified that any dissemination, distribution or copying of this communication 
is strictly prohibited. If you have received this e-mail in error, please 
notify the sender immediately and delete all copies from your computer system. 
Subsequent alterations to this email after its transmission will be disregarded.

-
To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
For additional commands, e-mail: server-user-h...@james.apache.org



RE: [EXT] Re: Java Mail API Sort

2020-05-14 Thread David Matthews
hi Sean

Is this even a James issue?

The jwma webmail program offers sorting of email either oldest first (which is 
javamail default), newest first or by sender. It's agnostic of the particular 
imap server and runs the same with james or dovecot.

Don't remember how it does this, but source code is available and I think it's 
fairly readable :-)

--
David Matthews
m...@dmatthews.org


-
To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
For additional commands, e-mail: server-user-h...@james.apache.org



RE: [EXT] Re: Java Mail API Sort

2020-05-14 Thread Sean McElroy
I'm trying to retrieve messages by sorted by date, using the JavaMail API. Here 
is my code:

try (Store store = connectToMessageStore(username, password);
 IMAPFolder emailFolder = (IMAPFolder)store.getFolder("INBOX")) {

emailFolder.open(Folder.READ_ONLY);
messageCount = emailFolder.getMessageCount();

Message[] messages = emailFolder.getSortedMessages(new SortTerm[] 
{SortTerm.DATE}); //THIS IS THE LINE THAT IS FAILING

messageList = getMessageConverter().toMessageSummary(messages);

} catch (MessagingException e) {
LOGGER.error(ERROR_READING_EMAIL_MESSAGES, e.getMessage());
throw new MessagingServiceException(e);
}


This is the error in my logs:

"Servlet.service() for servlet [dispatcherServlet] in context with path [] 
threw exception [Request processing failed; nested exception is 
aero.sita.ir.communicator.messaging.MessagingServiceException: 
javax.mail.MessagingException: SORT not supported;\n  nested exception 
is:\n\tcom.sun.mail.iap.BadCommandException: SORT not supported] with root 
cause"

My intention would be to page the results after sorting.

Best Regards,
Sean

-Original Message-
From: Matthieu Baechler 
Sent: Thursday 14 May 2020 07:58
To: James Users List 
Subject: [EXT] Re: Java Mail API Sort

Hi Sean,

On Wed, 2020-05-13 at 16:27 +, Sean McElroy wrote:
> Hello,
>
> Is there any way to configure James so that it supports the
> com.sun.mail.imap.IMAPFolder getSortedMessages method?

Could you tell us what you are trying to achieve and how? Do you have some code 
snippet to show us maybe?

> Thanks,
> Sean
>
> Confidential Communication: The contents of this e-mail including any
> attachment are confidential and intended solely for the person(s) to
> whom they are addressed. Any reader of this email who is not the
> intended recipient is notified that any dissemination, distribution or
> copying of this communication is strictly prohibited. If you have
> received this e-mail in error, please notify the sender immediately
> and delete all copies from your computer system. Subsequent
> alterations to this email after its transmission will be disregarded.

Well, this kind of legal footer has no place on a mailing list, could you 
configure your mailer agent to avoid sending that as it's irrelevant in that 
context?

Cheers,

--
Matthieu Baechler


-
To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
For additional commands, e-mail: server-user-h...@james.apache.org

Confidential Communication: The contents of this e-mail including any 
attachment are confidential and intended solely for the person(s) to whom they 
are addressed. Any reader of this email who is not the intended recipient is 
notified that any dissemination, distribution or copying of this communication 
is strictly prohibited. If you have received this e-mail in error, please 
notify the sender immediately and delete all copies from your computer system. 
Subsequent alterations to this email after its transmission will be disregarded.


Re: Java Mail API Sort

2020-05-13 Thread Matthieu Baechler
Hi Sean,

On Wed, 2020-05-13 at 16:27 +, Sean McElroy wrote:
> Hello,
> 
> Is there any way to configure James so that it supports the
> com.sun.mail.imap.IMAPFolder getSortedMessages method?

Could you tell us what you are trying to achieve and how? Do you have
some code snippet to show us maybe?

> Thanks,
> Sean
> 
> Confidential Communication: The contents of this e-mail including any
> attachment are confidential and intended solely for the person(s) to
> whom they are addressed. Any reader of this email who is not the
> intended recipient is notified that any dissemination, distribution
> or copying of this communication is strictly prohibited. If you have
> received this e-mail in error, please notify the sender immediately
> and delete all copies from your computer system. Subsequent
> alterations to this email after its transmission will be disregarded.

Well, this kind of legal footer has no place on a mailing list, could
you configure your mailer agent to avoid sending that as it's
irrelevant in that context?

Cheers,

-- 
Matthieu Baechler


-
To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
For additional commands, e-mail: server-user-h...@james.apache.org



Java Mail API Sort

2020-05-13 Thread Sean McElroy
Hello,

Is there any way to configure James so that it supports the 
com.sun.mail.imap.IMAPFolder getSortedMessages method?

Thanks,
Sean



Confidential Communication: The contents of this e-mail including any 
attachment are confidential and intended solely for the person(s) to whom they 
are addressed. Any reader of this email who is not the intended recipient is 
notified that any dissemination, distribution or copying of this communication 
is strictly prohibited. If you have received this e-mail in error, please 
notify the sender immediately and delete all copies from your computer system. 
Subsequent alterations to this email after its transmission will be disregarded.