Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #39174 > unrolled thread
| Started by | Martin Gregorie <martin@mydomain.invalid> |
|---|---|
| First post | 2019-11-05 01:14 +0000 |
| Last post | 2019-11-06 20:07 +0000 |
| Articles | 3 — 2 participants |
Back to article view | Back to comp.lang.java.programmer
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
| From | Martin Gregorie <martin@mydomain.invalid> |
|---|---|
| Date | 2019-11-05 01:14 +0000 |
| Subject | Some javax.mail clarification, please? |
| Message-ID | <qpqidp$lpu$1@dont-email.me> |
I'm building an application that will periodically process a batch of requests sent in by e-mail (before you ask, there are good reasons why it won't be run continuously). The code is running well in testing using Ben Fortuna's MSTOR extension to read test e-mails from a set of files: in production it will be using POP3 to read from a mail folder. I've just started POP3 testing and have run into a problem. It is successfully opening the mailbox it is configured to treat as input and connection to the default folder, INBOX, but is then failing to open that folder in READ_WRITE mode - I'm using mode that so I can delete each request message after processing it. However, initial tests are all failing to open the INBOX, which is empty. It just throws a MessagingException containing the message "Open failed". So, my question, should javax.mail.Folder.open() open an empty folder successfully or not? The documentation gives no clue about it. -- Martin | martin at Gregorie | gregorie dot org
[toc] | [next] | [standalone]
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| Date | 2019-11-06 11:00 -0500 |
| Message-ID | <qpuqme$h5t$1@dont-email.me> |
| In reply to | #39174 |
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.
Any chance you could use IMAP instead?
(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 ...)
--
esosman@comcast-dot-net.invalid
Four hundred forty-one days to go.
[toc] | [prev] | [next] | [standalone]
| From | Martin Gregorie <martin@mydomain.invalid> |
|---|---|
| Date | 2019-11-06 20:07 +0000 |
| Message-ID | <qpv95r$c9r$1@dont-email.me> |
| In reply to | #39175 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web