Zimlet JavaScript API Reference - ZmMailMsg

Class ZmMailMsg


Extends ZmMailItem.

Creates a new (empty) mail message.

Defined in: ZmMailMsg.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
ZmMailMsg(id, list, noCache)
Method Summary
Method Attributes Method Name and Description
 
addAddress(addr, type)
Adds the given address to the vector of addresses of the given type
 
addAddresses(type, addrs)
Adds the given vector of addresses to the vector of addresses of the given type
 
Sets the ID of any attachments which have already been uploaded.
 
addInlineAttachmentId(cid, aid, part, ismsg)
Adds an inline attachment.
 
addInlineDocAttachment(cid, docId, docpath, part)
Adds an inline document attachment.
<static>  
ZmMailMsg.addRequestHeaders(req)
Adds optional headers to the given request.
 
Clears out all the address vectors.
<static>  
ZmMailMsg.createFromDom(node, args, noCache)
Fills in the message from the given message node.
 
from a child window - since we clone the message, the cloned message needs to listen to changes on the original (parent window) message.
 
fetchAlternativePart(contentType, callback)
Fetches the requested alternative part and adds it to our MIME structure, and body parts.
<static>  
ZmMailMsg.fetchMsg(params)
Fetches a message from the server.
 
Finds the attachment in this message for the given CID.
 
getAddress(type)
Gets the first address in the vector of addresses of the given type.
 
getAddresses(type, used, addAsContact, dontUpdateUsed)
Gets a vector of addresses of the given type.
 
getAttachmentCount(includeInlineAtts)
Returns the number of attachments in this msg.
 
getAttachmentInfo(findHits, includeInlineImages, includeInlineAtts)
Returns an array of objects containing meta info about attachments
 
getBodyContent(contentType, useOriginal)
Gets the content of the first body part of the given content type (if provided).
 
getBodyPart(contentType, callback)
Returns the first body part, of the given type if provided.
 
getBodyParts(contentType)
Returns the list of body parts.
 
getFragment(maxLen)
Gets the fragment.
 
getHeaderStr(hdr, htmlMode)
Gets the header string.
 
Gets the inline attachments.
 
Gets the inline document attachments.
 
Gets the invite description content.
 
Gets the invite description content value.
 
Return list header id if it exists, otherwise returns null
 
Return mime header id if it exists, otherwise returns null
 
If message is sent on behalf of returns sender address otherwise returns from address
 
returns this user's reply to this invite.
 
getReplyAddresses(mode, aliases, isDefaultIdentity)
Gets a Reply-To address if there is one, otherwise the From address unless this message was sent by the user, in which case, it is the To field (but only in the case of Reply All).
 
Gets the status icon.
 
Gets the status tool tip.
 
Returns a text/plain or text-like (not HTML or calendar) body part
<static>  
ZmMailMsg.getTextFromCalendarPart(bodyPart)
Extracts and returns the text content out of a text/calendar part.
 
getUrlForPart(bodyPart)
Returns a URL that can be used to fetch the given part of this message.
 
Return the zimbra DL header if it exists, otherwise return null
 
hasContentType(contentType)
Returns true if this msg has loaded a part with the given content type.
 
Returns true if this message has an inline image
 
Returns true is the msg has more than one body part.
 
Checks if this message has html parts.
 
Checks if the message is read only.
 
load(params)
Gets the full message object from the back end based on the current message ID, and fills in the message.
 
send(isDraft, callback, errorCallback, accountName, noSave, requestReadReceipt, batchCmd, sendTime, isAutoSave)
Sends the message.
 
sendReadReceipt(callback)
Sends a read receipt.
 
setAddress(type, addr)
Sets the vector of addresses of the given type to the address given.
 
setAddresses(type, addrs)
Sets the vector of addresses of the given type to the given vector of addresses
 
setBodyParts(parts)
Sets the body parts.
 
Sets the ID of the contacts that are to be attached as vCards
 
Sets the IDs of docs to attach
 
Sets the list of attachment (message part) IDs to be forwarded
 
Sets the list of attachments details(message id and message part) to be forwarded
 
setHtmlContent(content)
Sets the html content, overriding that of any HTML body part.
 
setInviteDescriptionContent(contentType, content)
Sets the invite description.
 
Sets the IDs of messages to attach (as a forward)
 
setSubject(subject)
Sets the subject
 
setTopPart(part)
Sets the message's top part to the given MIME part
Methods borrowed from class ZmMailItem:
clear, getEmails, getMuteIcon, getReadIcon, ignoreJunkTrash
Methods borrowed from class ZmItem:
cache, canAddTag, create, deleteLocal, flagLocal, getById, getDefaultDndAction, getFolderId, getRestUrl, getTagImageFromIds, getTagImageInfo, hasTag, isShared, modify, move, moveLocal, removeAllTagsLocal, rename, setFlag, tagLocal
Methods borrowed from class ZmModel:
addChangeListener, removeAllChangeListeners, removeChangeListener
Class Detail
ZmMailMsg(id, list, noCache)
Parameters:
{int} id
the unique ID
{Array} list
the list that contains this message
{Boolean} noCache
if true, do not cache this message
Method Detail
addAddress(addr, type)
Adds the given address to the vector of addresses of the given type
Parameters:
{AjxEmailAddress} addr
an address
type

addAddresses(type, addrs)
Adds the given vector of addresses to the vector of addresses of the given type
Parameters:
{constant} type
the address type
{AjxVector} addrs
a vector of AjxEmailAddress objects

addAttachmentId(id)
Sets the ID of any attachments which have already been uploaded.
Parameters:
{String} id
an attachment ID

addInlineAttachmentId(cid, aid, part, ismsg)
Adds an inline attachment.
Parameters:
{String} cid
the content id
{String} aid
the attachment id
{String} part
the part
{Boolean} ismsg
if true, aid is a message id

addInlineDocAttachment(cid, docId, docpath, part)
Adds an inline document attachment.
Parameters:
{String} cid
the content id
{String} docId
the document id
{String} docpath
the document path
{String} part
the part

<static> ZmMailMsg.addRequestHeaders(req)
Adds optional headers to the given request.
Parameters:
{object|AjxSoapDoc} req
SOAP document or JSON parent object (probably a msg object)

clearAddresses()
Clears out all the address vectors.

<static> {ZmMailMsg} ZmMailMsg.createFromDom(node, args, noCache)
Fills in the message from the given message node. Whatever attributes and child nodes are available will be used. The message node is not always fully populated, since it may have been created as part of getting a conversation.
Parameters:
{Object} node
a message node
{Hash} args
a hash of arguments
{Boolean} noCache
if true, do not cache this message
Returns:
{ZmMailMsg} the message

detachedChangeListener(ev)
from a child window - since we clone the message, the cloned message needs to listen to changes on the original (parent window) message.
Parameters:
ev

fetchAlternativePart(contentType, callback)
Fetches the requested alternative part and adds it to our MIME structure, and body parts.
Parameters:
{string} contentType
MIME type of part to fetch
{callback} callback

<static> ZmMailMsg.fetchMsg(params)
Fetches a message from the server.
Parameters:
{Hash} params
a hash of parameters
{ZmZimbraMail} params.sender
the provides access to sendRequest()
{int} params.msgId
the ID of the msg to be fetched.
{int} params.partId
the msg part ID (if retrieving attachment part, i.e. rfc/822)
{int} params.ridZ
the RECURRENCE-ID in Z (UTC) timezone
{Boolean} params.getHtml
if true, try to fetch html from the server
{Boolean} params.markRead
if true, mark msg read
{AjxCallback} params.callback
the async callback
{AjxCallback} params.errorCallback
the async error callback
{Boolean} params.noBusyOverlay
if true, do not put up busy overlay during request
{Boolean} params.noTruncate
if true, do not truncate message body
{ZmBatchCommand} params.batchCmd
if set, request gets added to this batch command
{String} params.accountName
the name of the account to send request on behalf of
{boolean} params.needExp
if not false, have server check if addresses are DLs

{Object} findInlineAtt(cid)
Finds the attachment in this message for the given CID.
Parameters:
{String} cid
the content id
Returns:
{Object} the attachment or null if not found

{String} getAddress(type)
Gets the first address in the vector of addresses of the given type.
Parameters:
{constant} type
the type
Returns:
{String} the address

{AjxVector} getAddresses(type, used, addAsContact, dontUpdateUsed)
Gets a vector of addresses of the given type.
Parameters:
{constant} type
an email address type
{Hash} used
an array of addresses that have been used. If not null, then this method will omit those addresses from the returned vector and will populate used with the additional new addresses
{Boolean} addAsContact
if true, emails should be converted to ZmContact objects
{boolean} dontUpdateUsed
if true, do not update the hash of used addresses
Returns:
{AjxVector} a vector of email addresses

getAttachmentCount(includeInlineAtts)
Returns the number of attachments in this msg.
Parameters:
{boolean} includeInlineAtts

getAttachmentInfo(findHits, includeInlineImages, includeInlineAtts)
Returns an array of objects containing meta info about attachments
Parameters:
findHits
includeInlineImages
includeInlineAtts

{string} getBodyContent(contentType, useOriginal)
Gets the content of the first body part of the given content type (if provided). If HTML is requested, may return content set via setHtmlContent().
Parameters:
{string} contentType
MIME type
{boolean} useOriginal
if true, do not grab the copy w/ the images defanged (HTML only)
Returns:
{string} the content

{ZmMimePart} getBodyPart(contentType, callback)
Returns the first body part, of the given type if provided. May invoke a server call if it needs to fetch an alternative part.
Parameters:
{string} contentType
MIME type
{callback} callback
callback
Returns:
{ZmMimePart} MIME part

getBodyParts(contentType)
Returns the list of body parts.
Parameters:
{string} contentType
preferred MIME type of alternative parts (optional)

{String} getFragment(maxLen)
Gets the fragment. If maxLen is given, will truncate fragment to maxLen and add ellipsis.
Parameters:
{int} maxLen
the maximum length
Returns:
{String} the fragment

{String} getHeaderStr(hdr, htmlMode)
Gets the header string.
Parameters:
{constant} hdr
the header (see ZmMailMsg.HDR_ constants)
{boolean} htmlMode
if true, format as HTML
Returns:
{String} the value

{Array} getInlineAttachments()
Gets the inline attachments.
Returns:
{Array} an array of attachments

{Array} getInlineDocAttachments()
Gets the inline document attachments.
Returns:
{Array} an array of attachments

{String} getInviteDescriptionContent(contentType)
Gets the invite description content.
Parameters:
{String} contentType
the content type ("text/plain" or "text/html")
Returns:
{String} the content

{String} getInviteDescriptionContentValue(contentType)
Gets the invite description content value.
Parameters:
{String} contentType
the content type ("text/plain" or "text/html")
Returns:
{String} the content value

{String} getListIdHeader()
Return list header id if it exists, otherwise returns null
Returns:
{String} list id

{String} getMimeHeader(name)
Return mime header id if it exists, otherwise returns null
Parameters:
name
Returns:
{String} mime header value

{String} getMsgSender()
If message is sent on behalf of returns sender address otherwise returns from address
Returns:
{String} email address

getPtst()
returns this user's reply to this invite.

{AjxVector} getReplyAddresses(mode, aliases, isDefaultIdentity)
Gets a Reply-To address if there is one, otherwise the From address unless this message was sent by the user, in which case, it is the To field (but only in the case of Reply All). A list is returned, since theoretically From and Reply To can have multiple addresses.
Parameters:
mode
aliases
isDefaultIdentity
Returns:
{AjxVector} an array of AjxEmailAddress objects

{String} getStatusIcon()
Gets the status icon.
Returns:
{String} the icon

{String} getStatusTooltip()
Gets the status tool tip.
Returns:
{String} the tool tip

{ZmMimePart} getTextBodyPart()
Returns a text/plain or text-like (not HTML or calendar) body part
Returns:
{ZmMimePart} MIME part

<static> {string} ZmMailMsg.getTextFromCalendarPart(bodyPart)
Extracts and returns the text content out of a text/calendar part.
Parameters:
{ZmMimePart} bodyPart
a text/calendar MIME part
Returns:
{string} text content

{string} getUrlForPart(bodyPart)
Returns a URL that can be used to fetch the given part of this message.
Parameters:
{ZmMimePart} bodyPart
MIME part to fetch
Returns:
{string} URL to fetch the part

{AjxEmailAddress} getXZimbraDLHeader()
Return the zimbra DL header if it exists, otherwise return null
Returns:
{AjxEmailAddress} AjxEmailAddress object if header exists

hasContentType(contentType)
Returns true if this msg has loaded a part with the given content type.
Parameters:
{string} contentType
MIME type

{boolean} hasInlineImage()
Returns true if this message has an inline image
Returns:
{boolean}

{boolean} hasMultipleBodyParts()
Returns true is the msg has more than one body part. The server marks parts that it considers to be body parts.
Returns:
{boolean}

{Boolean} isHtmlMail()
Checks if this message has html parts.
Returns:
{Boolean} true if this message has HTML

{Boolean} isReadOnly()
Checks if the message is read only.
Returns:
{Boolean} true if read only

load(params)
Gets the full message object from the back end based on the current message ID, and fills in the message.
Parameters:
{Hash} params
a hash of parameters:
{Boolean} params.getHtml
if true, try to fetch html from the server
{Boolean} params.markRead
if true, mark msg read
{Boolean} params.forceLoad
if true, get msg from server
{AjxCallback} params.callback
the async callback
{AjxCallback} params.errorCallback
the async error callback
{Boolean} params.noBusyOverlay
if true, do not put up busy overlay during request
{Boolean} params.noTruncate
if true, do not set max limit on size of msg body
{ZmBatchCommand} params.batchCmd
if set, request gets added to this batch command
{String} params.accountName
the name of the account to send request on behalf of
{boolean} params.needExp
if not false, have server check if addresses are DLs

send(isDraft, callback, errorCallback, accountName, noSave, requestReadReceipt, batchCmd, sendTime, isAutoSave)
Sends the message.
Parameters:
{Boolean} isDraft
if true, this a draft
{AjxCallback} callback
the callback to trigger after send
{AjxCallback} errorCallback
the error callback to trigger
{String} accountName
the account to send on behalf of
{Boolean} noSave
if set, a copy will *not* be saved to sent regardless of account/identity settings
{Boolean} requestReadReceipt
if set, a read receipt is sent to *all* recipients
{ZmBatchCommand} batchCmd
if set, request gets added to this batch command
{Date} sendTime
if set, tell server that this message should be sent at the specified time
{Boolean} isAutoSave
if true, this an auto-save draft

sendReadReceipt(callback)
Sends a read receipt.
Parameters:
{closure} callback
response callback

setAddress(type, addr)
Sets the vector of addresses of the given type to the address given.
Parameters:
{constant} type
the address type
{AjxEmailAddress} addr
an address

setAddresses(type, addrs)
Sets the vector of addresses of the given type to the given vector of addresses
Parameters:
{constant} type
the address type
{AjxVector} addrs
a vector of AjxEmailAddress objects

setBodyParts(parts)
Sets the body parts.
Parameters:
{array} parts
an array of ZmMimePart

setContactAttIds(ids)
Sets the ID of the contacts that are to be attached as vCards
Parameters:
{Array} ids
a list of contact IDs

setDocumentAttachments(ids)
Sets the IDs of docs to attach
Parameters:
{Array} ids
a list of document IDs

setForwardAttIds(ids)
Sets the list of attachment (message part) IDs to be forwarded
Parameters:
{Array} ids
a list of attachment IDs

setForwardAttObjs(objs)
Sets the list of attachments details(message id and message part) to be forwarded
Parameters:
{Array} objs
a list of attachments details {id, part}

setHtmlContent(content)
Sets the html content, overriding that of any HTML body part.
Parameters:
{string} content
the HTML content

setInviteDescriptionContent(contentType, content)
Sets the invite description.
Parameters:
{String} contentType
the content type ("text/plain" or "text/html")
{String} content
the content

setMessageAttachmentId(ids)
Sets the IDs of messages to attach (as a forward)
Parameters:
{Array} ids
a list of mail message IDs

setSubject(subject)
Sets the subject
Parameters:
{String} subject
the subject

setTopPart(part)
Sets the message's top part to the given MIME part
Parameters:
{String} part
a MIME part

Documentation generated by JsDoc Toolkit 2.3.0 on Tue Jun 28 2016 21:01:36 GMT-0400 (EDT)