Package adams.flow.sink.sendnotification
Class Email
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.sink.sendnotification.AbstractNotification
-
- adams.flow.sink.sendnotification.Email
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,SizeOfHandler
,FlowContextHandler
,Serializable
public class Email extends AbstractNotification
Uses the incoming message as body in the email being sent.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected EmailAddress[]
m_BCC
the recipients (BCC).protected EmailAddress[]
m_CC
the recipients (CC).protected EmailAddress[]
m_Recipients
the recipients.protected AbstractSendEmail
m_SendEmail
for sending the emails.protected EmailAddress
m_Sender
the sender.protected BaseText
m_Signature
the signature.protected String
m_Subject
the subject.-
Fields inherited from class adams.flow.sink.sendnotification.AbstractNotification
m_FlowContext
-
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 Email()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
BCCTipText()
Returns the tip text for this property.String
CCTipText()
Returns the tip text for this property.protected String
check(String msg)
Hook method before attempting to send the message.void
defineOptions()
Adds options to the internal list of options.protected String
doSendNotification(String msg)
Sends the notification.EmailAddress[]
getBCC()
Returns the BCC recipients.EmailAddress[]
getCC()
Returns the CC recipients.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.EmailAddress[]
getRecipients()
Returns the recipients.AbstractSendEmail
getSendEmail()
Returns the object for sending emails.EmailAddress
getSender()
Returns the sender.BaseText
getSignature()
Returns the body of the email.String
getSubject()
Returns the subject.String
globalInfo()
Returns a string describing the object.protected void
initSession()
Initializes the SMTP session if required.String
recipientsTipText()
Returns the tip text for this property.String
sendEmailTipText()
Returns the tip text for this property.String
senderTipText()
Returns the tip text for this property.void
setBCC(EmailAddress[] value)
Sets the BCC recipients.void
setCC(EmailAddress[] value)
Sets the CC recipients.void
setRecipients(EmailAddress[] value)
Sets the recipients.void
setSendEmail(AbstractSendEmail value)
Sets the object for sending emails.void
setSender(EmailAddress value)
Sets the sender.void
setSignature(BaseText value)
Sets the body of the email.void
setSubject(String value)
Sets the subject.String
signatureTipText()
Returns the tip text for this property.String
subjectTipText()
Returns the tip text for this property.-
Methods inherited from class adams.flow.sink.sendnotification.AbstractNotification
getFlowContext, sendNotification, setFlowContext
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, 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
-
-
-
-
Field Detail
-
m_Sender
protected EmailAddress m_Sender
the sender.
-
m_Recipients
protected EmailAddress[] m_Recipients
the recipients.
-
m_CC
protected EmailAddress[] m_CC
the recipients (CC).
-
m_BCC
protected EmailAddress[] m_BCC
the recipients (BCC).
-
m_Subject
protected String m_Subject
the subject.
-
m_Signature
protected BaseText m_Signature
the signature.
-
m_SendEmail
protected AbstractSendEmail m_SendEmail
for sending the emails.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractNotification
- Returns:
- null if no info available, otherwise short string
-
setSender
public void setSender(EmailAddress value)
Sets the sender.- Parameters:
value
- the sender
-
getSender
public EmailAddress getSender()
Returns the sender.- Returns:
- the sender
-
senderTipText
public String senderTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setRecipients
public void setRecipients(EmailAddress[] value)
Sets the recipients.- Parameters:
value
- the recipients
-
getRecipients
public EmailAddress[] getRecipients()
Returns the recipients.- Returns:
- the recipients
-
recipientsTipText
public String recipientsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setCC
public void setCC(EmailAddress[] value)
Sets the CC recipients.- Parameters:
value
- the recipients
-
getCC
public EmailAddress[] getCC()
Returns the CC recipients.- Returns:
- the recipients
-
CCTipText
public String CCTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setBCC
public void setBCC(EmailAddress[] value)
Sets the BCC recipients.- Parameters:
value
- the recipients
-
getBCC
public EmailAddress[] getBCC()
Returns the BCC recipients.- Returns:
- the recipients
-
BCCTipText
public String BCCTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setSubject
public void setSubject(String value)
Sets the subject.- Parameters:
value
- the subject
-
getSubject
public String getSubject()
Returns the subject.- Returns:
- the subject
-
subjectTipText
public String subjectTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setSignature
public void setSignature(BaseText value)
Sets the body of the email.- Parameters:
value
- the body
-
getSignature
public BaseText getSignature()
Returns the body of the email.- Returns:
- the body
-
signatureTipText
public String signatureTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setSendEmail
public void setSendEmail(AbstractSendEmail value)
Sets the object for sending emails.- Parameters:
value
- the object
-
getSendEmail
public AbstractSendEmail getSendEmail()
Returns the object for sending emails.- Returns:
- the object
-
sendEmailTipText
public String sendEmailTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
check
protected String check(String msg)
Hook method before attempting to send the message.- Overrides:
check
in classAbstractNotification
- Parameters:
msg
- the message to send- Returns:
- null if successful, otherwise error message
-
initSession
protected void initSession() throws Exception
Initializes the SMTP session if required.- Throws:
Exception
- if initialization fails
-
doSendNotification
protected String doSendNotification(String msg)
Sends the notification.- Specified by:
doSendNotification
in classAbstractNotification
- Parameters:
msg
- the message to send- Returns:
- null if successfully sent, otherwise error message
-
-