|
Secure iNet Factory | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jscape.inet.smtp.Smtp
com.jscape.inet.smtpssh.SmtpSsh
public class SmtpSsh
Implements the basic functionality of a SMTP client tunnelling all data through a secure SSH connection.
Example Usage:
// connection parameters for SSH server String sshHostname = "smtp.myserver.com"; String sshUsername = "jsmith"; String sshPassword = "secret"; // create new SshParameters instance SshParameters sshParams = new SshParameters(sshHostname,sshUsername,sshPassword); // create new instance SmtpSsh smtp = new SmtpSsh(sshParams, "smtp.myserver.com"); // address the message EmailMessage message = new EmailMessage(); message.setTo("mjones@myserver.com"); message.setFrom("jsmith@myserver.com"); message.setSubject("Meeting today at 8"); message setBody("see you then"); // connect, send the message, disconnect try { smtp.connect(); smtp.send(message); smtp.disconnect(); } catch(Exception e) { System.out.println(e); }
Field Summary |
---|
Fields inherited from class com.jscape.inet.smtp.Smtp |
---|
AUTH_CRAM_MD5, AUTH_LOGIN |
Constructor Summary | |
---|---|
SmtpSsh()
Creates a new SmtpSsh instance. |
|
SmtpSsh(SshParameters sshParameters,
java.lang.String hostname)
Creates a new SmtpSsh instance. |
|
SmtpSsh(java.lang.String hostname)
Creates a new SmtpSsh instance. |
Method Summary | |
---|---|
void |
connect()
Connects to SMTP server tunnelling data through SSH server. |
void |
disconnect()
Disconnects from SMTP and SSH servers. |
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. |
Methods inherited from class com.jscape.inet.smtp.Smtp |
---|
addSmtpListener, clearProxySettings, getConnectTimeout, getDebugStream, getHostname, getPort, getReadTimeout, getTimeout, isConnected, isDebug, issueCommand, login, login, main, removeSmtpListener, send, send, send, setConnectTimeout, setDebug, setDebugStream, setHeloAddress, setHostname, setPort, setProxyAuthentication, setProxyHost, setProxyType, setReadTimeout, setTimeout |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SmtpSsh(java.lang.String hostname)
hostname
- the SMTP server hostnamepublic SmtpSsh(SshParameters sshParameters, java.lang.String hostname)
hostname
- the SMTP server hostnamesshParameters
- the SSH parameters used in establishing secure connectionpublic SmtpSsh()
Method Detail |
---|
public void connect() throws SmtpException
connect
in class Smtp
SmtpException
- thrown for I/O or SMTP related errorpublic void disconnect() throws SmtpException
disconnect
in class Smtp
SmtpException
- thrown to handle SMTP and I/O related errorsSmtpException
public SshParameters getSshParameters()
SshParameters
public void setSshParameters(SshParameters parameters)
parameters
- the SSH parametersSshParameters
|
Secure iNet Factory | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |