public class SendMail extends TypedAtomicActor
By default, this actor will not actually send email, but will rather produce the formatted email on its output port. The reason for this is that sending email should be done with some hesitation, since it is easy with such an actor to create a flood of email that will have undesirable effects. To get the actor to actually send email, change the value of the reallySendMail parameter to true. Upon completion of an execution, reallySendMail will be set back to false (in the wrapup() method) to help prevent accidental duplicate mailings.
This actor requires the JavaMail 1.5 javax.mail.jar file be in the classpath.
To use this actor, download javax.mail.jar
https://java.net/projects/javamail/pages/Home and place it in
$PTII/vendors/misc/javamail. Below are the steps:
cd $PTII/vendors/misc/javamail
wget --no-check-certificate http://java.net/projects/javamail/downloads/download/javax.mail.jar
cd $PTII
./configure
In Eclipse, you will then need to refresh the project.
*| Red (cxh) |
| Yellow (eal) |
Entity.ContainedObjectsIterator| Modifier and Type | Field and Description |
|---|---|
FileParameter |
attach
File to attach, if any.
|
PortParameter |
cc
Email address to copy on the message.
|
Parameter |
enableSSL
Enable the Secure Sockets Layer (SSL) protocol.
|
PortParameter |
from
Email address from which this is sent.
|
PortParameter |
message
The message to send.
|
TypedIOPort |
output
Output to which the formatted message is sent.
|
PortParameter |
password
Password port of the account.
|
Parameter |
reallySendMail
If true, then actually send the email.
|
PortParameter |
replyTo
The address to which replies should be directed.
|
PortParameter |
SMTPHostName
Host name for the send mail server.
|
PortParameter |
SMTPPort
Outgoing SMTP mail port.
|
PortParameter |
SMTPUserName
User name for the send mail server.
|
PortParameter |
subject
The subject line.
|
PortParameter |
to
Email address(es) to which this is sent.
|
_typesValid_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKSCOMPLETED, NOT_READY, STOP_ITERATING| Constructor and Description |
|---|
SendMail(CompositeEntity container,
java.lang.String name)
Construct an actor with the given container and name.
|
| Modifier and Type | Method and Description |
|---|---|
void |
attributeChanged(Attribute attribute)
React to a change in an attribute.
|
boolean |
postfire()
Update the parameters based on any available inputs
and then send one email message.
|
void |
preinitialize()
Set up the properties for the SMTP protocol.
|
_containedTypeConstraints, _customTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, declareDelayDependency, fire, getCausalityInterface, getDirector, getExecutiveDirector, getManager, initialize, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, prefire, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate, wrapup_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspaceequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcreateReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortListfire, isFireFunctional, isStrict, iterate, prefire, stop, stopFire, terminateaddInitializable, initialize, removeInitializable, wrapupdescription, getContainer, getDisplayName, getFullName, getName, getName, setNamegetDerivedLevel, getDerivedList, propagateValuepublic FileParameter attach
public PortParameter cc
public PortParameter from
public PortParameter message
public TypedIOPort output
public PortParameter password
public PortParameter replyTo
public Parameter reallySendMail
public PortParameter SMTPHostName
public PortParameter SMTPPort
public PortParameter SMTPUserName
public Parameter enableSSL
public PortParameter subject
public PortParameter to
public SendMail(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container - The container.name - The name of this actor.IllegalActionException - If the actor cannot be contained
by the proposed container.NameDuplicationException - If the container already has an
actor with this name.public void attributeChanged(Attribute attribute) throws IllegalActionException
attributeChanged in class NamedObjattribute - The attribute that changed.IllegalActionException - If the change is not acceptable
to this container (not thrown in this base class).public void preinitialize()
throws IllegalActionException
preinitialize in interface Initializablepreinitialize in class AtomicActor<TypedIOPort>IllegalActionException - If the superclass throws it.public boolean postfire()
throws IllegalActionException
postfire in interface Executablepostfire in class AtomicActor<TypedIOPort>IllegalActionException - If any of several errors
occur while attempting to send the message.