adams.core.net
Class AbstractSendEmail

java.lang.Object
  extended by adams.core.ConsoleObject
      extended by adams.core.option.AbstractOptionHandler
          extended by adams.core.net.AbstractSendEmail
All Implemented Interfaces:
Debuggable, Destroyable, OptionHandler, SizeOfHandler, Serializable
Direct Known Subclasses:
ApacheSendEmail, JavaMailSendEmail

public abstract class AbstractSendEmail
extends AbstractOptionHandler

Ancestor for classes that can send emails.

Version:
$Revision: 7123 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
Serialized Form

Field Summary
 
Fields inherited from class adams.core.option.AbstractOptionHandler
m_DebugLevel, m_OptionManager
 
Constructor Summary
AbstractSendEmail()
           
 
Method Summary
abstract  void initializeSmtpSession(String server, int port, boolean useTLS, int timeout, boolean requiresAuth, String user, BasePassword pw)
          Initializes the SMTP session.
abstract  boolean requiresSmtpSessionInitialization()
          Returns whether the SMTP session needs to be initialized.
abstract  boolean sendMail(Email email)
          Sends an email.
 
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, debug, debug, debugLevelTipText, defineOptions, destroy, finishInit, getDebugLevel, getOptionManager, globalInfo, initialize, isDebugOn, newOptionManager, reset, setDebugLevel, toCommandLine, toString
 
Methods inherited from class adams.core.ConsoleObject
getDebugging, getSystemErr, getSystemOut, sizeOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractSendEmail

public AbstractSendEmail()
Method Detail

requiresSmtpSessionInitialization

public abstract boolean requiresSmtpSessionInitialization()
Returns whether the SMTP session needs to be initialized.

Returns:
true if the SMTP session needs to be initialized

initializeSmtpSession

public abstract void initializeSmtpSession(String server,
                                           int port,
                                           boolean useTLS,
                                           int timeout,
                                           boolean requiresAuth,
                                           String user,
                                           BasePassword pw)
                                    throws Exception
Initializes the SMTP session.

Parameters:
server - the SMTP server
port - the SMTP port
useTLS - whether to use TLS
timeout - the timeout
requiresAuth - whether authentication is required
user - the SMTP user
pw - the SMTP password
Throws:
Exception - if initialization fails

sendMail

public abstract boolean sendMail(Email email)
                          throws Exception
Sends an email.

Parameters:
email - the email to send
Returns:
true if successfully sent
Throws:
Exception - in case of invalid internet addresses or messaging problem


Copyright © 2013 University of Waikato, Hamilton, NZ. All Rights Reserved.