Emailer component uses Java Mail 1.3.1 and Java Activation framework version 1.0.2. It provides APIs to send single and multi part email messages over SMTP protocol.
How to build
First build smarfrog framework by running ant dist in core/smartfrog
Build ant tasks by running ant in core/extras/ant
Build Emailer by running ant in core/components/emailer
Step 3 creates three jar files in core/components/emailer.build/dist/lib. Copy these jar files to core/smartfrog/dist/lib or update class path for the SmartFrog daemon so that emailer classes are available at run time.
|to||Comma separated email addresses for to||Mandatory|
|cc||Comma separated email addresses for cc||Optional|
|from||Email address from which mail is being send||Mandatory|
|smtpHost||SMTP Server used to send emails over SMTP protocol||Mandatory|
|subject||Subject of the email||Optional|
|message||List of remote files corresponding to local files in the form of a vector.||Optional|
|runAsWorkFlowComponent||Boolean attribute to enable emailer component run as a standard workflow component. In this mode Emailer is terminated after sending the email. By default it is true.||Mandatory|
|attachments||Vector of attachments each element denotes one file in file system||Optional|
|sendOnStartup||Flag to indicate that a message should be sent on startup.Implicitly true when runAsWorkflowComponent is set||Optional|
|sendOnShutdown||Flag to indicate a message should be sent on shutdown||Optional|
Modes of Usage
Emailer component can be used in following two modes.
In this mode Emailer sends email when its life cycle method sfStart is executed and terminates after sending the email. It happens only once in the components life cycle. In this mode other components in the work-flow may not be aware of Emailer component.
For example this mode be be useful in applications installations using Smartfrog. A typical application installation has components grouped in a sequence work flow. Emailer component can be placed as last component of the sequence and can be configured to send installation log after the installation is complete.
Please go through emailer/src/org/smartfrog/services/email/exampleUsageAsWFComp.sf for sample usage.
In this mode Emailer component is used as a utility component. Other components can find its reference and invoke of sendEmail API. This utility method can be invoked as long as this component is deployed.
Remotely deployed components can also use Emailer component by getting it's reference using SmartFrog reference resolution mechanism. However in this mode components are supposed to override default attributes of Emailer component. Emailer component provides different flavors of sendEmail API to achieve this.
Please go through core/components/emailer/ src/org/smartfrog/services/email/example.sf for sample usage.
When used as a utility component, the component can also send a message on startup if "sendOnStartup" is set to true. This gives you email-on-startup semantics without the immediate termination of a workflow component.