<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Wed Jun 25 00:04:05 PDT 2003 -->
<TITLE>
JavaMail API documentation: Package com.sun.mail.pop3
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">

<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_top"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-use.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../com/sun/mail/imap/package-summary.html"><B>PREV PACKAGE</B></A>&nbsp;
&nbsp;<A HREF="../../../../com/sun/mail/smtp/package-summary.html"><B>NEXT PACKAGE</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="package-summary.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->

<HR>
<H2>
Package com.sun.mail.pop3
</H2>
A POP3 protocol provider for the JavaMail API
that provides access to a POP3 message store.
<P>
<B>See: </B>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="#package_description"><B>Description</B></A>
<P>

<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Class Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="POP3Folder.html">POP3Folder</A></B></TD>
<TD>A POP3 Folder (can only be "INBOX").</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="POP3Message.html">POP3Message</A></B></TD>
<TD>A POP3 Message.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="POP3Store.html">POP3Store</A></B></TD>
<TD>A POP3 Message Store.</TD>
</TR>
</TABLE>
&nbsp;

<P>
<A NAME="package_description"><!-- --></A><H2>
Package com.sun.mail.pop3 Description
</H2>

<P>
A POP3 protocol provider for the JavaMail API
that provides access to a POP3 message store.
Refer to <A HREF="http://www.ietf.org/rfc/rfc1939.txt">RFC 1939</A>
for more information.
<P>
The POP3 provider provides a Store object that contains a single Folder
named "INBOX". Due to the limitations of the POP3 protocol, many of
the JavaMail API capabilities like event notification, folder management,
flag management, etc. are not allowed.  The corresponding methods throw
the MethodNotSupportedException exception; see below for details.
<P>
Note that JavaMail does <strong>not</strong> include a local store into
which messages can be downloaded and stored.  See our
<A HREF="http://java.sun.com/products/javamail/Third_Party.html">
Third Party Products</A>
web page for availability of "mbox" and "MH" local store providers.
<P>
The POP3 provider is accessed through the JavaMail APIs by using the protocol
name "pop3" or a URL of the form "pop3://user:password@host:port/INBOX".
<P>
POP3 supports only a single folder named "INBOX".
<P>
POP3 supports <strong>no</strong> permanent flags (see
<A HREF="../../../../javax/mail/Folder.html#getPermanentFlags()"><CODE>Folder.getPermanentFlags()</CODE></A>).
In particular, the <code>Flags.Flag.RECENT</code> flag will never be set
for POP3
messages.  It's up to the application to determine which messages in a
POP3 mailbox are "new".  There are several strategies to accomplish
this, depending on the needs of the application and the environment:
<P>
<UL>
<LI>
A simple approach would be to keep track of the newest
message seen by the application.
</LI>
<LI>
An alternative would be to keep track of the UIDs (see below)
of all messages that have been seen.
</LI>
<LI>
Another approach is to download <strong>all</strong> messages into a local
mailbox, so that all messages in the POP3 mailbox are, by
definition, new.
</LI>
</UL>
<P>
All approaches will require some permanent storage associated with the client.
<P>
POP3 does not support the <code>Folder.expunge()</code> method.  To delete and
expunge messages, set the <code>Flags.Flag.DELETED</code> flag on the messages
and close the folder using the <code>Folder.close(true)</code> method.  You
cannot expunge without closing the folder.
<P>
POP3 does not provide a "received date", so the <code>getReceivedDate</code>
method will return null.
It may be possible to examine other message headers (e.g., the
"Received" headers) to estimate the received date, but these techniques
are error-prone at best.
<P>
The POP3 provider supports the POP3 UIDL command, see
<A HREF="../../../../com/sun/mail/pop3/POP3Folder.html#getUID(javax.mail.Message)"><CODE>POP3Folder.getUID()</CODE></A>.
You can use it as follows:
<P>
<BLOCKQUOTE><PRE>
if (folder instanceof com.sun.mail.pop3.POP3Folder) {
    com.sun.mail.pop3.POP3Folder pf =
	(com.sun.mail.pop3.POP3Folder)folder;
    String uid = pf.getUID(msg);
    if (uid != null)
	... // use it
}
</PRE></BLOCKQUOTE>
<P>
You can also pre-fetch all the UIDs for all messages like this:
<P>
<BLOCKQUOTE><PRE>
FetchProfile fp = new FetchProfile();
fp.add(UIDFolder.FetchProfileItem.UID);
folder.fetch(folder.getMessages(), fp);
</PRE></BLOCKQUOTE>
<P>
Then use the technique above to get the UID for each message.  This is
similar to the technique used with the UIDFolder interface supported by
IMAP, but note that POP3 UIDs are strings, not integers like IMAP
UIDs.  See the POP3 spec for details.
<P>
The POP3 protocol provider supports the following properties,
which may be set in the JavaMail <code>Session</code> object.
The properties are always set as strings; the Type column describes
how the string is interpreted.  For example, use
<PRE>
	props.put("mail.pop3.port", "888");
</PRE>
to set the <CODE>mail.pop3.port</CODE> property, which is of type int.
<P>
<TABLE BORDER>
<TR>
<TH>Name</TH>
<TH>Type</TH>
<TH>Description</TH>
</TR>

<TR>
<TD>mail.pop3.user</TD>
<TD>String</TD>
<TD>Default user name for POP3.</TD>
</TR>

<TR>
<TD>mail.pop3.host</TD>
<TD>String</TD>
<TD>The POP3 server to connect to.</TD>
</TR>

<TR>
<TD>mail.pop3.port</TD>
<TD>int</TD>
<TD>The POP3 server port to connect to, if the connect() method doesn't
explicitly specify one. Defaults to 110.</TD>
</TR>

<TR>
<TD>mail.pop3.connectiontimeout</TD>
<TD>int</TD>
<TD>Socket connection timeout value in milliseconds.
Default is infinite timeout.</TD>
</TR>

<TR>
<TD>mail.pop3.timeout</TD>
<TD>int</TD>
<TD>Socket I/O timeout value in milliseconds.  Default is infinite timeout.</TD>
</TR>

<TR>
<TD>mail.pop3.rsetbeforequit</TD>
<TD>boolean</TD>
<TD>
Send a POP3 RSET command when closing the folder, before sending the
QUIT command.  Useful with POP3 servers that implicitly mark all
messages that are read as "deleted"; this will prevent such messages
from being deleted and expunged unless the client requests so.  Default
is false.
</TD>
</TR>

<TR>
<TD>mail.pop3.message.class</TD>
<TD>String</TD>
<TD>
Class name of a subclass of <code>com.sun.mail.pop3.POP3Message</code>.
The subclass can be used to handle (for example) non-standard
Content-Type headers.  The subclass must have a public constructor
of the form <code>MyPOP3Message(Folder f, int msgno)
throws MessagingException</code>.
</TD>
</TR>
</TABLE>
<P>
In general, applications should not need to use the classes in this
package directly.  Instead, they should use the APIs defined by
<code>javax.mail</code> package (and subpackages).  Applications should
never construct instances of <code>POP3Store</code> or
<code>POP3Folder</code> directly.  Instead, they should use the
<code>Session</code> method <code>getStore</code> to acquire an
appropriate <code>Store</code> object, and from that acquire
<code>Folder</code> objects.
<P>
<strong>WARNING:</strong> The APIs unique to this package should be
considered <strong>EXPERIMENTAL</strong>.  They may be changed in the
future in ways that are incompatible with applications using the
current APIs.
<P>
<HR>

<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_bottom"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-use.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../com/sun/mail/imap/package-summary.html"><B>PREV PACKAGE</B></A>&nbsp;
&nbsp;<A HREF="../../../../com/sun/mail/smtp/package-summary.html"><B>NEXT PACKAGE</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="package-summary.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->

<HR>

</BODY>
</HTML>
