M
Matthew Strawbridge
Hi,
I've written a spam filter that happily uses the standard javax.mail
classes to get message headers from the server (so I can do some
simple filtering). This is all via POP3.
I want to extend this so that if a message has been viewed, but not
deleted, then it should be treated as "safe". The difficulty I am
having is identifying whether or not a message has been read already.
Now I know that there is no guarantee that a POP3 server will tell you
whether or not a mail has been read, but that many servers set the
appropriate headers so that msg.isSet(Flags.Flag.SEEN) is true.
Unfortunately, my ISP (demon) takes a different approach.
As described on
http://www.demon.net/helpdesk/products/mail/sdps-tech.shtml they have
added an extra POP3 command "*ENV n", where n is the message number,
and returns a response "OK" for unread or "RD" for read messages.
My question is how can I best send this raw command to the POP3 server
and parse the response? I got a bit lost in the javax.mail docs - what
(if anything) do I need to extend to get some access to input and
output streams, or should I be using a different library entirely (I
think there are some mail classes in the Jakarta commons)?
Thanks for your help,
Matthew
PS There is no IMAP support, so I have to use POP3.
I've written a spam filter that happily uses the standard javax.mail
classes to get message headers from the server (so I can do some
simple filtering). This is all via POP3.
I want to extend this so that if a message has been viewed, but not
deleted, then it should be treated as "safe". The difficulty I am
having is identifying whether or not a message has been read already.
Now I know that there is no guarantee that a POP3 server will tell you
whether or not a mail has been read, but that many servers set the
appropriate headers so that msg.isSet(Flags.Flag.SEEN) is true.
Unfortunately, my ISP (demon) takes a different approach.
As described on
http://www.demon.net/helpdesk/products/mail/sdps-tech.shtml they have
added an extra POP3 command "*ENV n", where n is the message number,
and returns a response "OK" for unread or "RD" for read messages.
My question is how can I best send this raw command to the POP3 server
and parse the response? I got a bit lost in the javax.mail docs - what
(if anything) do I need to extend to get some access to input and
output streams, or should I be using a different library entirely (I
think there are some mail classes in the Jakarta commons)?
Thanks for your help,
Matthew
PS There is no IMAP support, so I have to use POP3.