Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #39176

Re: Some javax.mail clarification, please?

From Martin Gregorie <martin@mydomain.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Some javax.mail clarification, please?
Date 2019-11-06 20:07 +0000
Organization A noiseless patient Spider
Message-ID <qpv95r$c9r$1@dont-email.me> (permalink)
References <qpqidp$lpu$1@dont-email.me> <qpuqme$h5t$1@dont-email.me>

Show all headers | View raw


On Wed, 06 Nov 2019 11:00:13 -0500, Eric Sosman wrote:

> On 11/4/2019 8:14 PM, Martin Gregorie wrote:
>> [...]
>> I've just started POP3 testing and have run into a problem.
>> [...]
>> So, my question, should javax.mail.Folder.open() open an empty folder
>> successfully or not? The documentation gives no clue about it.
> 
>      (Piping up not because I know anything, but because I haven't
> seen any other responses yet ...)
> 
>      My understanding of POP is that it has no notion of "folders"
> at all, but instead throws all the messages into one big bag and tags
> them with various attributes.  There really wouldn't be an "empty
> folder" as such, just a lack of any messages bearing the tag that
> simulates folder membership.  What does that mean for JavaMail?  Sorry:
> I have no idea.
> 
This is how the javax.javamail package's model seems to be that a Store 
class contains one or more Folder classes which in turn contain one or 
more messages which are accessed via an index number. 

So, to read mail you first create a message Store and connect that to a 
source, this probably being the mapping step, Opening a default folder in 
the Store works for protocols which have can be mapped onto one, such as 
POP3 while in mdir the file of messages becomes the Folder and in maildir 
the directory holding the messages becomes the Folder. To complete the 
picture, 

I think its likely that the package uses this model because almost any 
mail service can be mapped into it - so for POP3 it instantiates the 
single INBOX folder and maps available message onto it.

>      Any chance you could use IMAP instead?
>
I'd like to stick to pop3  because my LAN uses it - I use Postfix as the 
MTA and Dovecot to distribute mail to the various MUAs on my LAN. I just 
had a quick look at the IMAP side. It looks a bit more complex , not 
least because it allows you to use Folder trees, while POP3 only allows 
the single INBOX folder.

However, its quite possible that, as I said earlier that this folder may 
not exist or be creatable if empty: Messages are accessed by number and 
'msgNo' is 1-based so it would make a mad sort of sense if empty folders 
simply cant exist.   

In any case I have a private mail archive because its hugely faster to 
search the PostgreSQL database holding the archive than it is to ferret 
through MUA mail folders holding gigabytes/thousands of messages. Its 
loader runs nightly using POP3 and AFAICR has never needed to open an 
empty folder of messages.

>      (Bear in mind that I'm writing from almost perfect ignorance
> and may be perfectly mistaken.  My advice may be worth less than you're
> paying for it ...)
>
No problem: thanks for your input. Its made me look under a few more 
rocks and that's always a useful thing to do.

-- 
Martin    | martin at
Gregorie  | gregorie dot org

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Some javax.mail clarification, please? Martin Gregorie <martin@mydomain.invalid> - 2019-11-05 01:14 +0000
  Re: Some javax.mail clarification, please? Eric Sosman <esosman@comcast-dot-net.invalid> - 2019-11-06 11:00 -0500
    Re: Some javax.mail clarification, please? Martin Gregorie <martin@mydomain.invalid> - 2019-11-06 20:07 +0000

csiph-web