Package helma.scripting.rhino.extensions
Class MailObject
java.lang.Object
org.mozilla.javascript.ScriptableObject
helma.scripting.rhino.extensions.MailObject
- All Implemented Interfaces:
Serializable
,org.mozilla.javascript.ConstProperties
,org.mozilla.javascript.debug.DebuggableObject
,org.mozilla.javascript.Scriptable
,org.mozilla.javascript.SymbolScriptable
A JavaScript wrapper around a JavaMail message class to send
mail via SMTP from Helma
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.mozilla.javascript.ScriptableObject
org.mozilla.javascript.ScriptableObject.KeyComparator
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
Fields inherited from class org.mozilla.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
Fields inherited from interface org.mozilla.javascript.Scriptable
NOT_FOUND
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a BCC address for this messagevoid
ADd a CC address for this messagevoid
Add a MIME message part to a multipart messagevoid
Add some text to a plain text message.void
Add a To address for this messageOverrides abstract method in ScriptableObjectReturns the MIME multipart message subtype.protected javax.mail.Session
Get the cached JavaMail session.int
Returns the error status of this message.static void
init
(org.mozilla.javascript.Scriptable scope, Properties props) Initialize Mail extension for the given scope, called by RhinoCore.static MailObject
mailObjCtor
(org.mozilla.javascript.Context cx, Object[] args, org.mozilla.javascript.Function ctorObj, boolean inNewExpr) JavaScript constructor, called by the Rhino runtime.void
send()
Send the message.void
Set the From address for this messagevoid
setMultipartType
(String subtype) Sets the MIME multipart message subtype.void
setReplyTo
(String addstr) Set the Reply-to address for this messageprotected void
setStatus
(int status) Set the error status of this messagevoid
setSubject
(Object subject) Set the subject of this messagevoid
Set the text to a plain text message, clearing any previous text.void
Set the To address for this messageMethods inherited from class org.mozilla.javascript.ScriptableObject
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChangeForSlot, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureScriptableObjectButNotSymbol, ensureSymbolScriptable, equivalentValues, get, get, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getSuperProperty, getSuperProperty, getSuperProperty, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, has, hasInstance, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, put, putConst, putConstProperty, putOwnProperty, putOwnProperty, putOwnProperty, putProperty, putProperty, putProperty, putSuperProperty, putSuperProperty, putSuperProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size
-
Field Details
-
OK
public static final int OK- See Also:
-
SUBJECT
public static final int SUBJECT- See Also:
-
TEXT
public static final int TEXT- See Also:
-
MIMEPART
public static final int MIMEPART- See Also:
-
TO
public static final int TO- See Also:
-
CC
public static final int CC- See Also:
-
BCC
public static final int BCC- See Also:
-
FROM
public static final int FROM- See Also:
-
REPLYTO
public static final int REPLYTO- See Also:
-
SEND
public static final int SEND- See Also:
-
-
Method Details
-
getClassName
Overrides abstract method in ScriptableObject- Specified by:
getClassName
in interfaceorg.mozilla.javascript.Scriptable
- Specified by:
getClassName
in classorg.mozilla.javascript.ScriptableObject
-
getSession
protected javax.mail.Session getSession()Get the cached JavaMail session. This is similar to Session.getDefaultSession(), except that we check if the properties have changed. -
mailObjCtor
public static MailObject mailObjCtor(org.mozilla.javascript.Context cx, Object[] args, org.mozilla.javascript.Function ctorObj, boolean inNewExpr) JavaScript constructor, called by the Rhino runtime. -
init
Initialize Mail extension for the given scope, called by RhinoCore. -
setStatus
protected void setStatus(int status) Set the error status of this message- Parameters:
status
- the new error status
-
getStatus
public int getStatus()Returns the error status of this message.- Returns:
- the error status of this message
-
addText
Add some text to a plain text message. -
setText
Set the text to a plain text message, clearing any previous text. -
getMultipartType
Returns the MIME multipart message subtype. The default value is "mixed" for messages of type multipart/mixed. A common value is "alternative" for the multipart/alternative MIME type.- Returns:
- the MIME subtype such as "mixed" or "alternative"
-
setMultipartType
Sets the MIME multipart message subtype. The default value is "mixed" for messages of type multipart/mixed. A common value is "alternative" for the multipart/alternative MIME type.- Parameters:
subtype
- the MIME subtype such as "mixed" or "alternative".
-
addPart
Add a MIME message part to a multipart message- Parameters:
obj
- the MIME part object. Supported classes are java.lang.String, java.io.File and helma.util.MimePart.filename
- optional file name for the mime part
-
setSubject
Set the subject of this message- Parameters:
subject
- the message subject
-
setReplyTo
Set the Reply-to address for this message- Parameters:
addstr
- the email address to set in the Reply-to header
-
setFrom
Set the From address for this message- Parameters:
addstr
- the email address to set in the From headername
- the name this address belongs to
-
setTo
Set the To address for this message- Parameters:
addstr
- the email address to set in the To headername
- the name this address belongs to
-
addTo
Add a To address for this message- Parameters:
addstr
- the email address to set in the To headername
- the name this address belongs to
-
addCC
ADd a CC address for this message- Parameters:
addstr
- the email address to set in the CC headername
- the name this address belongs to
-
addBCC
Add a BCC address for this message- Parameters:
addstr
- the email address to set in the BCC headername
- the name this address belongs to
-
send
public void send()Send the message.
-