com.isti.quakewatch.util
Class JavaMailTransport

java.lang.Object
  extended by com.isti.quakewatch.util.JavaMailTransport

public class JavaMailTransport
extends java.lang.Object

Class JavaMailTransport defines transport methods for using Sun's JavaMail package to send mail.


Constructor Summary
JavaMailTransport()
           
 
Method Summary
protected  void connect(Transport transportObj)
          Connect to the server.
 Authenticator getAuthenticator()
          Get the authenticator.
 void sendMessage(Message msgObj, Session sessionObj)
          Send a message.
 void setAuthentication(boolean b)
          Set the authentication flag.
 void setHost(java.lang.String host)
          Set the host.
 void setPassword(java.lang.String password)
          Set the password.
 void setPort(int port)
          Set the port.
 void setUser(java.lang.String user)
          Set the user.
 void testServerConnection(Session sessionObj)
          Tests the connection to the mail server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaMailTransport

public JavaMailTransport()
Method Detail

connect

protected void connect(Transport transportObj)
                throws MessagingException
Connect to the server.

Parameters:
transportObj - the transport.
Throws:
MessagingException - if failure.

getAuthenticator

public Authenticator getAuthenticator()
Get the authenticator.

Returns:
the authenticator or null if none.

sendMessage

public void sendMessage(Message msgObj,
                        Session sessionObj)
                 throws MessagingException
Send a message.

Parameters:
msgObj - the message.
sessionObj - the mail session or null if none.
Throws:
MessagingException - if the message could not be sent to some or any of the recipients.

setAuthentication

public void setAuthentication(boolean b)
Set the authentication flag.

Parameters:
b - true for authentication, false otherwise.

setHost

public void setHost(java.lang.String host)
Set the host.

Parameters:
host - the host.

setPassword

public void setPassword(java.lang.String password)
Set the password.

Parameters:
password - the password.

setPort

public void setPort(int port)
Set the port.

Parameters:
port - the port.

setUser

public void setUser(java.lang.String user)
Set the user.

Parameters:
user - the user.

testServerConnection

public void testServerConnection(Session sessionObj)
                          throws MessagingException
Tests the connection to the mail server.

Parameters:
sessionObj - the mail session.
Throws:
NoSuchProviderException - if transport provider is not found.
MessagingException - if failure.