public class ImapSsh extends Imap
// connection information for SSH server String sshHostname = "imap4.myserver.com"; String sshUsername = "jsmith"; String sshPassword = "secret"; // create new SshParameters instance SshParameters sshParams = new SshParameters(sshHostname,sshUsername,sshPassword); // new instance with SSH parameters hostname, username and password ImapSsh imap = new ImapSsh(sshParams,"imap4.myserver.com","jsmith","secret"); try { // connect to IMAP4 server imap.connect(); // get messages int messageCount = imap.getMessageCount(); for(int i = 1; i <= messageCount(); ++i) { EmailMessage em = imap.getMessage(i); } // disconnect imap.disconnect(); } catch(Exception e) { System.out.println(e); }
Imap.Authentication
AUTH_CRAM_MD5, AUTH_LOGIN, AUTH_XOAUTH2, FLAG_ANSWERED, FLAG_DELETED, FLAG_DRAFT, FLAG_FLAGGED, FLAG_MODE_ADD, FLAG_MODE_DELETE, FLAG_MODE_REPLACE, FLAG_RECENT, FLAG_SEEN
Constructor and Description |
---|
ImapSsh()
Creates a new ImapSsh instance.
|
ImapSsh(SshParameters sshParameters,
java.lang.String hostname,
java.lang.String username,
java.lang.String password)
Creates a new ImapSsh instance.
|
ImapSsh(java.lang.String hostname,
java.lang.String username,
java.lang.String password)
Creates a new ImapSsh instance.
|
Modifier and Type | Method and Description |
---|---|
ImapSsh |
connect()
Connects to IMAP server tunelling data through SSH server and performs login with IMAP server.
|
void |
disconnect()
Disconnects from IMAP server.
|
SshParameters |
getSshParameters()
Gets SSH parameters used in establishing connection with SSH server.
|
void |
setSshParameters(SshParameters parameters)
Sets SSH parameters used in establishing connection with SSH server.
|
addImapListener, append, append, clearProxySettings, close, createMailbox, deleteMailbox, deleteMessage, deleteMessages, expunge, getAuthMode, getConnectTimeout, getDebugStream, getHostname, getMailboxes, getMessage, getMessageCount, getMessageHeader, getMessageHeaders, getMessageID, getMessages, getMessages, getMessages, getMessagesWithFlags, getMessagesWithFlags, getMessagesWithFlags, getMessageWithFlags, getNewMessageID, getNewMessages, getNewMessagesWithFlags, getPort, getReadTimeout, getTimeout, getUid, getUid, getUsername, isConnected, isDebug, isDelete, issueCommand, listMailboxes, listMailboxes, removeImapListener, renameMailbox, selectMailbox, setAuthentication, setAuthMode, setConnectTimeout, setDebug, setDebugStream, setDelete, setHostname, setPassword, setPort, setProxyAuthentication, setProxyHost, setProxyType, setReadTimeout, setTimeout, setUsername, store, store
public ImapSsh()
public ImapSsh(java.lang.String hostname, java.lang.String username, java.lang.String password)
hostname
- the IMAP hostnameusername
- the IMAP usernamepassword
- the IMAP passwordpublic ImapSsh(SshParameters sshParameters, java.lang.String hostname, java.lang.String username, java.lang.String password)
hostname
- the IMAP hostnameusername
- the IMAP usernamepassword
- the IMAP passwordsshParameters
- the SSH parameters used in establishing a secure connectionpublic ImapSsh connect() throws ImapException
connect
in class Imap
ImapException
- if I/O or IMAP related error occurspublic void disconnect() throws ImapException
disconnect
in class Imap
ImapException
- if I/O or IMAP related error occursImap.connect()
public SshParameters getSshParameters()
SshParameters
public void setSshParameters(SshParameters parameters)
parameters
- the SSH parametersSshParameters
Copyright © JSCAPE LLC. 1999-2021. All Rights Reserved