Using the PopSsh class

Top  Previous  Next

The PopSsh class is a subclass of the com.jscape.inet.pop.Pop class.  It provides access to all the same features as the Pop class with the exception that all data is securely tunneled thru an SSH server.  To use the PopSsh class create a new PopSsh instance providing a com.jscape.inet.ssh.util.SshParameters instance as an argument to the constructor.

 

Example

 

// connection parameters for SSH server

String sshHostname = "pop3.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

PopSsh pop = new PopSsh(sshParams, "pop3.myserver.com","jsmith","secret");

try

{

// connect to POP3 server

 pop.connect();

  // get messages

 Enumeration e = pop.getMessages();

while(e.hasMoreElements()) {

   EmailMessage em = (EmailMessage)e.nextElement();

 }

  // disconnect

 pop.disconnect();

}

catch(Exception e)

{

 System.out.println(e);

}

 

See also

 

Pop class overview

 





Home | Company | Products | Solutions | Purchase | Support | Services | Blog

© 2021 JSCAPE LLC