Package org.apache.commons.net.imap
Class IMAPClient
java.lang.Object
org.apache.commons.net.SocketClient
org.apache.commons.net.imap.IMAP
org.apache.commons.net.imap.IMAPClient
- Direct Known Subclasses:
- IMAPSClient
The IMAPClient class provides the basic functionalities found in an IMAP client.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic enumThe message data item names for the FETCH command defined in RFC 3501.static enumThe search criteria defined in RFC 3501.static enumThe status data items defined in RFC 3501.Nested classes/interfaces inherited from class org.apache.commons.net.imap.IMAPIMAP.IMAPChunkListener, IMAP.IMAPState
- 
Field SummaryFields inherited from class org.apache.commons.net.imap.IMAP__DEFAULT_ENCODING, __writer, _reader, DEFAULT_PORT, TRUE_CHUNK_LISTENERFields inherited from class org.apache.commons.net.SocketClient_defaultPort_, _hostname_, _input_, _output_, _serverSocketFactory_, _socket_, _socketFactory_, _timeout_, connectTimeout, NETASCII_EOL, remoteInetSocketAddress
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleanDeprecated.(3.4) Does not work; the message body is not optional.booleanDeprecated.(3.4) Does not work; the message body is not optional.booleanSend an APPEND command to the server.booleanSend a CAPABILITY command to the server.booleancheck()Send a CHECK command to the server.booleanclose()Send a CLOSE command to the server.booleanSend a COPY command to the server.booleanSend a CREATE command to the server.booleanSend a DELETE command to the server.booleanSend an EXAMINE command to the server.booleanexpunge()Send an EXPUNGE command to the server.booleanSend a FETCH command to the server.booleanSend a LIST command to the server.booleanLogin to the IMAP server with the given user and password.booleanlogout()Send a LOGOUT command to the server.booleanSend an LSUB command to the server.booleannoop()Send a NOOP command to the server.booleanSend a RENAME command to the server.booleanSend a SEARCH command to the server.booleanSend a SEARCH command to the server.booleanSend a SELECT command to the server.booleanSend a STATUS command to the server.booleanSend a STORE command to the server.booleanSend a SUBSCRIBE command to the server.booleanSend a UID command to the server.booleanunsubscribe(String mailboxName) Send a UNSUBSCRIBE command to the server.Methods inherited from class org.apache.commons.net.imap.IMAP_connectAction_, disconnect, doCommand, doCommand, fireReplyReceived, generateCommandID, getReplyString, getReplyStrings, getState, sendCommand, sendCommand, sendCommand, sendCommand, sendData, setChunkListener, setStateMethods inherited from class org.apache.commons.net.SocketClientaddProtocolCommandListener, applySocketAttributes, checkOpenOutputStream, connect, connect, connect, connect, connect, connect, createCommandSupport, fireCommandSent, getCharset, getCharsetName, getCommandSupport, getConnectTimeout, getDefaultPort, getDefaultTimeout, getKeepAlive, getLocalAddress, getLocalPort, getProxy, getReceiveBufferSize, getRemoteAddress, getRemoteInetSocketAddress, getRemotePort, getSendBufferSize, getServerSocketFactory, getSoLinger, getSoTimeout, getTcpNoDelay, isAvailable, isConnected, removeProtocolCommandListener, setCharset, setConnectTimeout, setDefaultPort, setDefaultTimeout, setKeepAlive, setProxy, setReceiveBufferSize, setSendBufferSize, setServerSocketFactory, setSocketFactory, setSoLinger, setSoTimeout, setTcpNoDelay, verifyRemote
- 
Constructor Details- 
IMAPClientpublic IMAPClient()
 
- 
- 
Method Details- 
appendDeprecated.(3.4) Does not work; the message body is not optional. Useappend(String, String, String, String)instead.Send an APPEND command to the server.- Parameters:
- mailboxName- The mailbox name.
- Returns:
- trueif the command was successful,- falseif not.
- Throws:
- IOException- If a network I/O error occurs.
 
- 
append@Deprecated public boolean append(String mailboxName, String flags, String datetime) throws IOException Deprecated.(3.4) Does not work; the message body is not optional. Useappend(String, String, String, String)instead.Send an APPEND command to the server.- Parameters:
- mailboxName- The mailbox name.
- flags- The flag parenthesized list (optional).
- datetime- The date/time string (optional).
- Returns:
- trueif the command was successful,- falseif not.
- Throws:
- IOException- If a network I/O error occurs.
 
- 
appendpublic boolean append(String mailboxName, String flags, String datetime, String message) throws IOException Send an APPEND command to the server.- Parameters:
- mailboxName- The mailbox name.
- flags- The flag parenthesized list (optional).
- datetime- The date/time string (optional).
- message- The message to append.
- Returns:
- trueif the command was successful,- falseif not.
- Throws:
- IOException- If a network I/O error occurs.
- Since:
- 3.4
 
- 
capabilitySend a CAPABILITY command to the server.- Returns:
- trueif the command was successful,- falseif not.
- Throws:
- IOException- If a network I/O error occurs
 
- 
checkSend a CHECK command to the server.- Returns:
- trueif the command was successful,- falseif not.
- Throws:
- IOException- If a network I/O error occurs.
 
- 
closeSend a CLOSE command to the server.- Returns:
- trueif the command was successful,- falseif not.
- Throws:
- IOException- If a network I/O error occurs.
 
- 
copySend a COPY command to the server.- Parameters:
- sequenceSet- The sequence set to fetch.
- mailboxName- The mailbox name.
- Returns:
- trueif the command was successful,- falseif not.
- Throws:
- IOException- If a network I/O error occurs.
 
- 
createSend a CREATE command to the server.- Parameters:
- mailboxName- The mailbox name to create.
- Returns:
- trueif the command was successful,- falseif not.
- Throws:
- IOException- If a network I/O error occurs.
 
- 
deleteSend a DELETE command to the server.- Parameters:
- mailboxName- The mailbox name to delete.
- Returns:
- trueif the command was successful,- falseif not.
- Throws:
- IOException- If a network I/O error occurs.
 
- 
examineSend an EXAMINE command to the server.- Parameters:
- mailboxName- The mailbox name to examine.
- Returns:
- trueif the command was successful,- falseif not.
- Throws:
- IOException- If a network I/O error occurs.
 
- 
expungeSend an EXPUNGE command to the server.- Returns:
- trueif the command was successful,- falseif not.
- Throws:
- IOException- If a network I/O error occurs.
 
- 
fetchSend a FETCH command to the server.- Parameters:
- sequenceSet- The sequence set to fetch (e.g. 1:4,6,11,100:*)
- itemNames- The item names for the FETCH command. (e.g. BODY.PEEK[HEADER.FIELDS (SUBJECT)]) If multiple item names are requested, these must be enclosed in parentheses, e.g. "(UID FLAGS BODY.PEEK[])"
- Returns:
- trueif the command was successful,- falseif not.
- Throws:
- IOException- If a network I/O error occurs.
- See Also:
 
- 
listSend a LIST command to the server. Quotes the parameters if necessary.- Parameters:
- refName- The reference name If empty, indicates that the mailbox name is interpreted as by SELECT.
- mailboxName- The mailbox name. If empty, this is a special request to return the hierarchy delimiter and the root name of the name given in the reference
- Returns:
- trueif the command was successful,- falseif not.
- Throws:
- IOException- If a network I/O error occurs.
 
- 
loginLogin to the IMAP server with the given user and password. You must first connect to the server withconnectbefore attempting to log in. A login attempt is only valid if the client is in the NOT_AUTH_STATE. After logging in, the client enters the AUTH_STATE.- Parameters:
- user- The account name being logged in to.
- password- The plain text password of the account.
- Returns:
- True if the login attempt was successful, false if not.
- Throws:
- IOException- If a network I/O error occurs in the process of logging in.
 
- 
logoutSend a LOGOUT command to the server. To fully disconnect from the server you must call disconnect(). A logout attempt is valid in any state. If the client is in the not authenticated or authenticated state, it enters the logout on a successful logout.- Returns:
- trueif the command was successful,- falseif not.
- Throws:
- IOException- If a network I/O error occurs.
 
- 
lsubSend an LSUB command to the server. Quotes the parameters if necessary.- Parameters:
- refName- The reference name.
- mailboxName- The mailbox name.
- Returns:
- trueif the command was successful,- falseif not.
- Throws:
- IOException- If a network I/O error occurs.
 
- 
noopSend a NOOP command to the server. This is useful for keeping a connection alive since most IMAP servers will time out after 10 minutes of inactivity.- Returns:
- trueif the command was successful,- falseif not.
- Throws:
- IOException- If a network I/O error occurs.
 
- 
renameSend a RENAME command to the server.- Parameters:
- oldMailboxName- The existing mailbox name to rename.
- newMailboxName- The new mailbox name.
- Returns:
- trueif the command was successful,- falseif not.
- Throws:
- IOException- If a network I/O error occurs.
 
- 
searchSend a SEARCH command to the server.- Parameters:
- criteria- The search criteria.
- Returns:
- trueif the command was successful,- falseif not.
- Throws:
- IOException- If a network I/O error occurs.
 
- 
searchSend a SEARCH command to the server.- Parameters:
- charset- The charset (optional).
- criteria- The search criteria.
- Returns:
- trueif the command was successful,- falseif not.
- Throws:
- IOException- If a network I/O error occurs.
 
- 
selectSend a SELECT command to the server.- Parameters:
- mailboxName- The mailbox name to select.
- Returns:
- trueif the command was successful,- falseif not.
- Throws:
- IOException- If a network I/O error occurs.
 
- 
statusSend a STATUS command to the server.- Parameters:
- mailboxName- The reference name.
- itemNames- The status data item names.
- Returns:
- trueif the command was successful,- falseif not.
- Throws:
- IOException- If a network I/O error occurs.
 
- 
storeSend a STORE command to the server.- Parameters:
- sequenceSet- The sequence set to update (e.g. 2:5)
- itemNames- The item name for the STORE command (i.e. [+|-]FLAGS[.SILENT])
- itemValues- The item values for the STORE command. (e.g. (\Deleted) )
- Returns:
- trueif the command was successful,- falseif not.
- Throws:
- IOException- If a network I/O error occurs.
 
- 
subscribeSend a SUBSCRIBE command to the server.- Parameters:
- mailboxName- The mailbox name to subscribe to.
- Returns:
- trueif the command was successful,- falseif not.
- Throws:
- IOException- If a network I/O error occurs.
 
- 
uidSend a UID command to the server.- Parameters:
- command- The command for UID.
- commandArgs- The arguments for the command.
- Returns:
- trueif the command was successful,- falseif not.
- Throws:
- IOException- If a network I/O error occurs.
 
- 
unsubscribeSend a UNSUBSCRIBE command to the server.- Parameters:
- mailboxName- The mailbox name to unsubscribe from.
- Returns:
- trueif the command was successful,- falseif not.
- Throws:
- IOException- If a network I/O error occurs.
 
 
-