Package adams.core.net
Class AbstractSendEmail
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.core.net.AbstractSendEmail
-
- All Implemented Interfaces:
CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,Serializable
- Direct Known Subclasses:
ApacheSendEmail
,JavaMailSendEmail
,SimpleApacheSendEmail
public abstract class AbstractSendEmail extends AbstractOptionHandler implements CleanUpHandler
Ancestor for classes that can send emails.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AbstractSendEmail()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
cleanUp()
Cleans up data structures, frees up memory.abstract void
initializeSmtpSession(String server, int port, boolean useTLS, boolean useSSL, int timeout, boolean requiresAuth, String user, BasePassword pw, String protocols)
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, defineOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
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, boolean useSSL, int timeout, boolean requiresAuth, String user, BasePassword pw, String protocols) throws Exception
Initializes the SMTP session.- Parameters:
server
- the SMTP serverport
- the SMTP portuseTLS
- whether to use TLSuseSSL
- whether to use SSLtimeout
- the timeoutrequiresAuth
- whether authentication is requireduser
- the SMTP userpw
- the SMTP passwordprotocols
- the protocols to use, empty for default- 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
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.
Default implementation does nothing.- Specified by:
cleanUp
in interfaceCleanUpHandler
-
-