Package com.jalios.jcms.mail
Class MailMessage
java.lang.Object
com.jalios.jstore.BasicStorable
com.jalios.jcms.Data
com.jalios.jcms.Publication
com.jalios.jcms.Content
com.jalios.jcms.mail.MailMessage
- All Implemented Interfaces:
EditableData,JcmsConstants,ImportConstants,MashupConstants,StrongLockable,Searchable,Storable,JaliosConstants,LangPropertyArgument,TreeNode,Cloneable,Comparable<BasicStorable>
Class used to build and send a mail message.
Example :
MailMessage msg = new MailMessage("myplugin.log-mail");
msg.setTo(channel.getDefaultAdmin());
msg.setSubject("[" + channel.getName() + "] Daily log");
msg.setContentText("Daily log attached");
msg.addFile(new File(channel.getRealPath("WEB-INF/data/logs/jcms.log")));
msg.send();
logger.info("Log mail sent in " + DateUtil.formatDuration(msg.getDuration()));
MailMessage msg = new MailMessage("starwarsplugin.war-mail-alert");
msg.setFrom("Darth Vader <dv@deathstar.com>");
msg.setTo("Son <luke@alliance.com>");
msg.setBcc("Palpatine <palpatine@deathstar.com>");
for (Member sithMember : sithGroup.getMemberSet()) {
msg.addCc(sithMember);
}
msg.setSubject("I am your father");
msg.setContentText("The Force is with you, young Skywalker. But you are not a Jedi yet.");
msg.setContentHtml("The <strong>Force</strong> is with you, young Skywalker. But you are not a Jedi yet.");
msg.send();
- Since:
- jcms-6.0.1
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classConvenient recursive structure to wrap javax.mail.Message Partstatic classMailMessage.SentDateComparator<T extends MailMessage>Compares two MailMessage using their SentDate in descending order (newest date first).Nested classes/interfaces inherited from class com.jalios.jcms.Publication
Publication.AdateComparator<T extends Publication>, Publication.AdateSelector, Publication.AudienceRightComparator<T extends Publication>, Publication.AudienceRightSelector, Publication.AuthorComparator<T extends Publication>, Publication.AuthorizedSelector, Publication.CanWorkOnSelector, Publication.DdateComparator<T extends Publication>, Publication.EdateComparator<T extends Publication>, Publication.EdateSelector, Publication.PdateComparator<T extends Publication>, Publication.PdateSelector, Publication.PopularityComparator<T extends Publication>, Publication.PstatusComparator<T extends Publication>, Publication.PstatusSelector, Publication.ReaderComparator<T extends Publication>, Publication.ReadRightSelector, Publication.RelatedCategoryComparator<T extends Publication>, Publication.RightComparator<T extends Publication>, Publication.SdateComparator<T extends Publication>, Publication.SdateSelector, Publication.TitleComparator<T extends Publication>, Publication.TrackedSelector, Publication.TypeComparator<T extends Publication>, Publication.UdateComparator<T extends Publication>, Publication.UdateSelector, Publication.UserContentSelector, Publication.VisibleStateSelector, Publication.VoteScoreComparator<T extends Publication>, Publication.WorkspaceAuthorSelector, Publication.WorkspaceComparator<T extends Publication>, Publication.WorkspaceSelectorNested classes/interfaces inherited from class com.jalios.jcms.Data
Data.AuthorSelector, Data.CdateSelector, Data.DataNameComparator<T extends Data>, Data.DeletableSelector, Data.ImportSelector, Data.MdateSelector, Data.OpAuthorComparator<T extends Data>, Data.RowIdComparator<T extends Data>, Data.StrongLockSelectorNested classes/interfaces inherited from class com.jalios.jstore.BasicStorable
BasicStorable.CdateComparator<T extends Storable>, BasicStorable.IdComparator<T extends Storable>, BasicStorable.MdateComparator<T extends Storable> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected longprotected javax.mail.Messageprotected Collection<MailMessage.Part> static final StringFields inherited from class com.jalios.jcms.Publication
ACL_CAN_ATTACH_WS, adate, attachWorkspaceSet, ATTACHWS_CHECK_PUB_RIGHTS_PROP, authorizedGroupSet, authorizedMemberSet, authorizedMemberSetDBID, categories, categorySet, classificationLevel, CTRL_TOPIC_ADVANCED, CTRL_TOPIC_CATEGORIES, CTRL_TOPIC_FRIENDLY_URLS, CTRL_TOPIC_WORKFLOW, CTX_COPY_CATEGORIES, CTX_COPY_TITLE, CTX_COPY_TITLEML, CTX_COPY_WORKSPACE, CTX_PSTATUS_UPDATE, dbFriendlyURLSet, dbFriendlyURLSetInit, edate, extendedReadRightsDBData, friendlyURLSet, hasAttachWS, hasNoReadRightsDBData, hasNoReadRightsDBDataInitialized, indexMgr, isTracked, mainInstance, mainInstanceId, mainLanguage, majorVersion, mergeDate, mergeId, minorVersion, pdate, pstatus, PUBLICATION_WFNOTE, readAck, readerCount, restrictUpdateRights, roleMap, sdate, SYNC_ATTACH_WORKSPACE_MEDIA_ENABLED_PROP, templates, title, titleML, udate, updateGroupSet, updateMemberSet, voteCount, voteScore, weakDataImage, wfExpressAlarmEntry, wfReminderAlarmEntry, workflowId, workspace, workspaceIdFields inherited from class com.jalios.jcms.Data
author, authorDBID, channel, DISPLAY_URL_EXTRA_INFO, extraDataMap, extraDBDataMapToSaveOnOp, importMap, opAuthor, opDelegate, WRITE_IN_PROGRESS_EXTRA_INFO, WYSIWYG_INLINE_EDIT_REQUEST_PARAMETERFields inherited from class com.jalios.jstore.BasicStorable
cdate, ddate, id, isStoreCache, mdate, storeFields inherited from interface com.jalios.jcms.mashup.ImportConstants
IMPORT_ALARM_MGR, IMPORT_AUTHOR_PROP, IMPORT_CATEGORY_DEFAULT, IMPORT_DC_ATTR, IMPORT_DC_STEP, IMPORT_DIR, IMPORT_ENABLED, IMPORT_JDOM_ELEMENT, IMPORT_LOG_FILE, IMPORT_LOG_MAX, IMPORT_OPTIONS, IMPORT_OPTIONS_DC_CONTEXT, IMPORT_ROOT_PROP, IMPORT_SOURCE_FILE, IMPORT_SOURCE_PREFIX_PROP, IMPORT_SOURCES_DIR, IMPORT_STEP_CLEAN, IMPORT_STEP_IMPORT, IMPORT_STEP_UPDATE_REF, IMPORT_WS_PROPFields inherited from interface com.jalios.util.JaliosConstants
CRLF, MILLIS_IN_ONE_DAY, MILLIS_IN_ONE_HOUR, MILLIS_IN_ONE_MINUTE, MILLIS_IN_ONE_MONTH, MILLIS_IN_ONE_SECOND, MILLIS_IN_ONE_WEEK, MILLIS_IN_ONE_YEARFields inherited from interface com.jalios.jcms.JcmsConstants
ADATE_SEARCH, ADVANCED_TAB, AJAX_MODE_ATTR, ARCHIVES_DIR, CATEGORY_TAB, CDATE_SEARCH, CLASS_PROPERTY, COMMON_ALARM, CONTENT_TAB, COOKIE_MAX_AGE, COUNTRY_SPRITE, CS_TYPOLOGY_ROOT_CAT_VID, CTRL_TOPIC_INTERNAL, CTRL_TOPIC_REF, CTRL_TOPIC_VALUE, CTRL_TOPIC_WRITE, CUSTOM_PROP, DATA_DIRECTORY, DEFAULT_PHOTO_PROP, DOCCHOOSER_HEIGHT, DOCCHOOSER_WIDTH, DOCS_DIR, EDATE_SEARCH, EMAIL_REGEXP, ERROR_MSG, FORBIDDEN_FILE_ACCESS, FORBIDDEN_REDIRECT, FORCE_REDIRECT, GENERATIONAL_STORE_DIRECTORY, GLYPH_ICON_PREFIX, ICON_ARCHIVE, ICON_ICON_PREFIX, ICON_LOCK, ICON_LOCK_STRONG, ICON_PREFIX_PROP, ICON_WARN, ICON_WH_BOOK_CLOSED, ICON_WH_BOOK_OPEN, INFORMATION_MSG, IS_IN_FRONT_OFFICE, JALIOS_JUNIT_PROP, JCMS_CADDY, JCMS_MSG_LIST, JCMS_TOASTR_COLLECTION, JSYNC_DOWNLOAD_DIR, JSYNC_SYNC_ALARM, LANG_SPRITE, LOG_FILE, LOG_TOPIC_SECURITY, LOGGER_PROP, LOGGER_XMLPROP, MBR_PHOTO_DIR, MDATE_SEARCH, MONITOR_XML, OP_CREATE, OP_CREATE_STR, OP_DEEP_COPY, OP_DEEP_COPY_STR, OP_DEEP_DELETE, OP_DEEP_DELETE_STR, OP_DELETE, OP_DELETE_STR, OP_MERGE, OP_MERGE_STR, OP_UPDATE, OP_UPDATE_STR, ORGANIZATION_ROOT_GROUP_PROP, PDATE_SEARCH, PHOTO_DIR, PHOTO_ICON, PHOTO_ICON_HEIGHT, PHOTO_ICON_PROP_PREFIX, PHOTO_ICON_WIDTH, PHOTO_LARGE, PHOTO_LARGE_HEIGHT, PHOTO_LARGE_PROP_PREFIX, PHOTO_LARGE_WIDTH, PHOTO_MINI, PHOTO_MINI_HEIGHT, PHOTO_MINI_PROP_PREFIX, PHOTO_MINI_WIDTH, PHOTO_NORMAL, PHOTO_NORMAL_HEIGHT, PHOTO_NORMAL_PROP_PREFIX, PHOTO_NORMAL_WIDTH, PHOTO_SMALL, PHOTO_SMALL_HEIGHT, PHOTO_SMALL_PROP_PREFIX, PHOTO_SMALL_WIDTH, PHOTO_TINY, PHOTO_TINY_HEIGHT, PHOTO_TINY_PROP_PREFIX, PHOTO_TINY_WIDTH, PHOTO_XLARGE, PHOTO_XLARGE_HEIGHT, PHOTO_XLARGE_PROP_PREFIX, PHOTO_XLARGE_WIDTH, PREVIOUS_TAB, PRINT_VIEW, PRIVATE_FILE_ACCESS, PUBLIC_FILE_ACCESS, RAW_CONTENT_ICON_PREFIX, READ_RIGHT_TAB, SDATE_SEARCH, SEARCHENGINE_ALARM, SECURITY_LOG_FILE, SESSION_AUTHORIZED_FILENAMES_SET, SPRITE_ICON_PREFIX, STATS_REPORT_DIR, STATUS_PROP, STORE_XML, SUCCESS_MSG, SVG_ICON_PREFIX, SVGINLINE_ICON_PREFIX, SVGSPRITE_ICON_PREFIX, TEMPLATE_TAB, THEME_DIR, THUMBNAIL_LARGE_HEIGHT, THUMBNAIL_LARGE_WIDTH, THUMBNAIL_SMALL_HEIGHT, THUMBNAIL_SMALL_WIDTH, TTCARD_MEDIA_HEIGHT, TTCARD_MEDIA_WIDTH, TYPES_ICON_ALT_PROP, TYPES_ICON_SUFFIX_PROP, TYPES_ICON_TITLE_PROP, TYPES_PREFIX_PROP, TYPES_THUMB_SUFFIX_PROP, TYPES_UNKNOWN_CLASS_PROP, UDATE_SEARCH, UPDATE_RIGHT_TAB, UPLOAD_DIR, UPLOAD_PERMISSION_COUNT_PROP_PREFIX, UPLOAD_PERMISSION_SIZE_PROP_PREFIX, URL_REGEXP, VID_LOGGED_MEMBER, WARNING_MSG, WEBAPP_PROP, WFEXPRESS_ALARM, WFREMINDER_ALARM, WORKFLOW_TAB, WORKFLOW_XMLFields inherited from interface com.jalios.jcms.mashup.MashupConstants
DATA_TAG, DATASET_TAG, FIELD_CLASS, FIELD_ENTRY, FIELD_ITEM, FIELD_KEY, FIELD_NAME, FIELD_TAG, FIELD_VALUE, FILE_FIELD, FILE_ID, FILE_MTIME, FILE_SIZE, FILE_TAG, FILE_TICKET, FILESET_TAG, RELATED_TAG -
Constructor Summary
ConstructorsConstructorDescriptionMailMessage(MailMessage other) MailMessage(Publication other) MailMessage(String origin) MailMessage(String from, String to, String subject, String body) MailMessage(javax.mail.Message msg) -
Method Summary
Modifier and TypeMethodDescriptionAdd a file to send with this MailMessage.Add a file to send with this MailMessage.voidbooleanReturns true if the authkey contained in the localpart of the "to" field is consistent with the "from" field.getAbstract(String lang, boolean useDefault) Returns an empty String.getAddressSet(javax.mail.Address[] ia) Returns a Set of Address.toString()getAttachements(boolean b) getBcc()javax.mail.internet.InternetAddress[]getBccIA()getBccMember(boolean b) getCc()javax.mail.internet.InternetAddress[]getCcIA()getCcMember(boolean b) javax.mail.BodyPart[]protected javax.activation.DataHandlergetDataHandler(File file) Compute the correct handler to manage this filelongRetrieve the time the sending process took to execute.Retrieve the Map of File/id to send in this MailMessage.protected StringgetFirstAddress(javax.mail.Address[] ia) Returns the first Address.toString()javax.mail.internet.InternetAddressResolve "From" from all froms and Member's fromprotected javax.mail.internet.InternetAddressgetFirstIA(String email, Member mbr) getFrom()javax.mail.internet.InternetAddress[]protected javax.mail.internet.InternetAddress[]getIAQuietly(Set<String> address, Set<Member> addressMember) Returns an array of InternetAddress joins of addresses and Member's addressesCollection<? extends MailMessage> Returns a Collection of MailMessage replies of the current MailMessageCollection<? extends MailMessage> Returns a Collection of MailMessage, thread of the current discussion in ascending order (oldest date first).getMatchingRecipient(String address) Returns the address matching (indexOf) the given address in all recipient and membersgetMatchingRecipient(Pattern pattern) Returns the address matching the given pattern in all recipient and membersintjavax.mail.internet.InternetAddress[]booleanGet whether acknowledge message should be sent at end of process.booleanGet sending mode, one mail for all recipients (false), or one mail for each recipients (true).Returns the single Member recipients of the message or null if there is multiple recipientsReturns a temporary Map of all mail's header.javax.mail.MessageReturns temporary javax.mail.Message store while fetching mail Message might be null. Message fields calls can throw Exception if MailBox is closed.Returns flatten collection of MailMessage.Part with decoded Files and ContentsgetTo()javax.mail.internet.InternetAddress[]getToIA()getToMember(boolean b) Collection<? extends TreeNode> Returns a Collection of TreeNode children of the current nodeReturns parent of the current nodeprotected voidperformBeforeWrite(int op, Member mbr, Map context) Called to perform some action before the write.voidremoveHeader(String key) voidsend()Send this MailMessage.voidSend this MailMessage.protected voidsendAcknowledge(Collection<MailMessage> successMessages, Collection<MailMessage> errorMessages) voidSend this MailMessage in a seperate thread.voidsendInThread(HashMap<String, Object> ctxt) Send this MailMessage in a seperate thread.voidsetAccount(String v) voidvoidvoidsetBccMember(Set<Member> v) voidvoidsetCcMember(Set<Member> v) voidsetContentHtmlFromJsp(String jspPath, Member loggedMember, String language, HashMap<Object, Object> requestAttribute, HashMap<Object, Object> sessionAttribute) Set the HTML text content of this MailMessage from the rendering of the specified jsp.voidsetContentTextFromJsp(String jspPath, Member loggedMember, String language, HashMap<Object, Object> requestAttribute, HashMap<Object, Object> sessionAttribute) Set the plain text content of this MailMessage from the rendering of the specified jsp.voidsetCustomBodyParts(javax.mail.BodyPart[] v) voidsetExpires(Date v) voidvoidvoidprotected voidsetMessage(javax.mail.Message msg) Set fields for the given Message and download attachements in temporary folder Caller should also set: Account setAccount() Author setAuthor()voidvoidvoidvoidvoidsetReferences(Set<String> v) setReplyTo(Member v) voidsetReplyTo(String v) voidvoidsetSendAcknowledge(boolean sendAcknowledge) Set whether acknowledge message should be sent at end of process.voidsetSendOneMailPerRecipient(boolean sendOneMailPerRecipient) Set sending mode, one mail for all recipients (false), or one mail for each recipients (true).voidsetSentDate(Date v) voidsetSubject(String v) voidvoidvoidsetToMember(Set<Member> v) Methods inherited from class com.jalios.jcms.Publication
ackRead, addAuthorizedGroup, addAuthorizedMember, addCategory, addFollower, addWeakReferrer, addWFExpressAlarm, addWFReminderAlarm, assignCommonPublicationFields, assignRole, assignRole, attachPublication, attachTo, canBeArchived, canBeArchived, canBeAttachedBy, canBeAttachedTo, canBeDetachedFrom, canBeEditedFieldByField, canBeFollowedBy, canBeReadBy, canBeReadBy, canBeVotedBy, canCreateCopy, canCreateCopy, canCreateCopy, canCreateWorkCopy, canMergeWorkCopy, canRequestUnlock, checkAndPerformTrash, checkAndPerformUntrash, checkCreate, checkDelete, checkIntegrity, checkLang, checkMember, checkMerge, checkStateChange, checkStateChange, checkTemplateEntry, checkTrash, checkUntrash, checkUpdate, checkWrite, cleanHybridCollections, clearTransientIndex, cloneDBDataCollections, computeSignature, computeSignature, containsCategory, createCopy, createCopy, createWFNote, createWFNote, createWorkCopy, createWorkCopy, detachFrom, discardCopy, exportXmlField, exportXmlRelated, getAbstract, getAbstract, getAbstractAsText, getAbstractML, getAccessCount, getAdate, getAdateComparator, getAdateSelector, getAllCatIdSet, getAllFilePath, getAllWikiText, getAllWysiwygText, getAttachWorkspaceSet, getAttachWSIdSet, getAudiencedRightsString, getAudienceRightComparator, getAudienceRightSelector, getAuthenticatedReaderCount, getAuthGrpIdSet, getAuthMbrIdSet, getAuthorizedGroupSet, getAuthorizedMemberSet, getAuthorizedMemberSet, getAuthorizedMemberSetDBID, getAuthorizedSelector, getCanWorkOnSelector, getCategories, getCategories, getCategorySet, getCatIdSet, getClassificationLevel, getComparator, getComparator, getComparator, getCSVHeader, getCurrentWorkerSet, getDataIcon, getDataIconTitle, getDataName, getDate, getDate, getDateSelector, getDBDataRevision, getDbFriendlyURLSet, getDdateComparator, getDefaultTemplateUsage, getDescendantCategorySet, getDescendantCategorySet, getDescendantCategorySet, getDisplayTemplateFile, getDocumentLinkSet, getEdate, getEdateComparator, getEdateSelector, getEffectiveClassificationLevel, getEstimatedReminderCount, getExtendedReadRights, getExternalLinkSet, getFieldInMainLanguage, getFieldValue, getFirstDescendantCategory, getFirstDescendantCategory, getFirstDescendantCategory, getFollowerList, getFriendlyURLSet, getGenericThumbnail, getHasAttachWS, getHasNoReadRights, getImportConflictCopy, getImportVersion, getIndexingDate, getInternalWorkflow, getLinkDataSet, getMainInstance, getMainInstanceId, getMainLanguage, getMajorVersion, getMemberSetAssignedToRole, getMergeDate, getMergeId, getMinorVersion, getNextWFStateSet, getPdate, getPdateComparator, getPdateSelector, getPopularity, getPopularityComparator, getPstatus, getPstatusAlarmEntry, getPstatusComparator, getPstatusSelector, getPstatusSelector, getQueryTemplateFile, getReadAck, getReadAckCount, getReaderComparator, getReaderCount, getReaderTracker, getReaderTrackerList, getReadRightSelector, getReadRightsString, getReferrerSet, getRestrictUpdateRights, getRightComparator, getRoleMap, getRoleMapStr, getSdate, getSdateComparator, getSdateSelector, getSearchStrings, getTemplate, getTemplateEntry, getTemplateEntry, getTemplateEntrySet, getTemplatePath, getTemplatePath, getTemplates, getTitle, getTitle, getTitle, getTitleComparator, getTitleComparator, getTitleML, getTitleMLE, getTrackedSelector, getTreeRoot, getTypeComparator, getTypeFieldLabel, getTypeLabel, getUdate, getUdateComparator, getUdateSelector, getUpdateGroupSet, getUpdateGrpIdSet, getUpdateMbrIdSet, getUpdateMemberSet, getVersionString, getVisibleStateSelector, getVoteCount, getVoteScore, getVoteScoreComparator, getVoteValue, getWeakReferrerSet, getWFNoteList, getWFState, getWFStateLabel, getWFStateLabelHtml, getWorkCopySet, getWorkflow, getWorkflowId, getWorkspace, getWorkspaceAuthorSelector, getWorkspaceComparator, getWorkspaceId, getWorkspaceSelector, getWSTypeEntry, getWSTypeEntry, hasAlreadyVoted, hasAnyReadRights, hasBeenReadAckBy, hasBeenReadBy, hasCategory, hasImportConflict, hasNoReadRights, hasWeakReferrers, importConvertToLocal, importMarkAsMerged, importOverrideAndUpdate, importXml, init, initCopy, initializeDBDataCollections, internalCanBeReadBy, invalidateWeakDataImage, isAudienced, isClassified, isDefaultTemplate, isFollowedBy, isImportConflictCopy, isInRole, isInVisibleState, isPublic, isRoleAssigned, isTracked, isTrashed, isTreeLeaf, isTreeNode, isUserContent, isUserContentType, isVersioned, isVotable, isWorkCopy, majorUpdate, notifyFollowers, performAfterWrite, performCreate, performDelete, performMerge, performMerge, performTrash, performUntrash, performUpdate, prepareMergeCopy, putPstatusAlarmEntry, recomputeScore, removeAllDescendants, removeAllFollowers, removeAllReaderTracker, removeAuthorizedGroup, removeAuthorizedMember, removeCategory, removeDataSet, removeFollower, removeImportMetadata, removePstatusAlarmEntry, removeWeakReferrer, removeWFExpressAlarm, removeWFReminderAlarm, resolveTypeTemplateEntry, setAbstract, setAbstract, setAdate, setAllCatIdSet, setAttachWorkspaceSet, setAttachWSIdSet, setAuthGrpIdSet, setAuthMbrIdSet, setAuthorizedGroupSet, setAuthorizedMemberSet, setAuthorizedMemberSetDBID, setCategories, setCategorySet, setCatIdSet, setCdate, setClassificationLevel, setDbFriendlyURLSet, setEdate, setExtendedReadRights, setFieldValue, setFriendlyURLSet, setHasAttachWS, setHasNoReadRights, setImportConflictCopy, setImportVersion, setMainInstance, setMainInstanceId, setMainLanguage, setMajorVersion, setMergeDate, setMergeId, setMinorVersion, setPdate, setPstatus, setReadAck, setReaderCount, setRestrictUpdateRights, setRoleMap, setRoleMapStr, setRoleMemberSetMap, setSdate, setTemplate, setTemplates, setTitle, setTitle, setTitleML, setTitleMLE, setTracked, setUdate, setUpdateGroupSet, setUpdateGrpIdSet, setUpdateMbrIdSet, setUpdateMemberSet, setVoteCount, setVoteScore, setWorkflow, setWorkflowId, setWorkspace, setWorkspaceId, splitHybridCollections, supportsClassification, toCSV, toFullString, toString, trackReader, trackReader, unassignMember, unassignRole, updateDisplayLinkCss, updateDisplayLinkDataAttribute, updatePstatus, updateTemplateMethods inherited from class com.jalios.jcms.Data
canBeReadBy, canBeUnlockedBy, checkAndPerformCreate, checkAndPerformCreate, checkAndPerformDelete, checkAndPerformDelete, checkAndPerformUpdate, checkAndPerformUpdate, checkCreate, checkDelete, checkIntegrity, checkLockMember, checkStrongLockMember, checkStrongLockMember, checkUpdate, cleanHybridCollection, cleanHybridCollection, cleanHybridCollection, clone, computeDBIDArray, computeDBIDList, computeDBIDSet, exportXml, exportXml, exportXml, exportXml, exportXmlRelated, fillExportXmlFieldAttributes, getAllReferrerSet, getAllReferrerSet, getAllRelatedData, getAllTypeFieldEntry, getAuthor, getAuthor, getAuthorComparator, getAuthorDBID, getAuthorId, getAuthorSelector, getBooleanFieldValue, getBooleanFieldValue, getCaddyComparator, getCategoryFieldValue, getCategoryFieldValue, getCdateSelector, getDataIconAlt, getDataIconCSS, getDataIconHtml, getDataIconHtml, getDataImage, getDataImage, getDataImage, getDataNameComparator, getDefaultFieldStatus, getDeletableSelector, getDisplayLink, getDisplayLink, getDisplayLink, getDisplayLink, getDisplayLinkCss, getDisplayLinkDataAttribute, getDisplayLinkHtmlAttributes, getDisplayUrl, getDoubleFieldValue, getDoubleFieldValue, getExportXmlDataValue, getExtraData, getExtraDataMap, getExtraDBData, getExtraDBDataMap, getExtraInfo, getExtraInfoMap, getFieldStatusMap, getFieldValue, getFieldValue, getFieldValue, getGenericThumbnail, getImportAuthor, getImportBatch, getImportDate, getImportDisplayUrl, getImportId, getImportMap, getImportMdate, getImportSelector, getImportSignature, getImportSource, getImportSourceUrl, getImportUrl, getIntFieldValue, getIntFieldValue, getLangPropertyValue, getLinkCount, getLinkIndexedDataSet, getLinkIndexedDataSet, getLockDate, getLockInfo, getLockMember, getLongFieldValue, getLongFieldValue, getMdateSelector, getNewDefaultExtraDataMap, getNewDefaultExtraDataMap, getNewDefaultExtraDataMap, getNewDefaultExtraDataMap, getNewDefaultExtraDBDataMap, getNewDefaultExtraDBDataMap, getNewDefaultExtraDBDataMap, getNewDefaultExtraDBDataMap, getOpAuthor, getOpAuthorComparator, getOpAuthorId, getOpDelegate, getReadAuthorizedSelector, getReferrerSet, getRowId, getRowIdComparator, getStrongLock, getStrongLockContext, getStrongLockContextData, getStrongLockDate, getStrongLockInfo, getStrongLockMember, getStrongLockSelector, getTypeEntry, getTypeFieldsEntries, getUpdateInstance, getVirtualIDSet, importXmlFieldsWithReferences, importXmlFiles, importXmlReferences, isDBData, isImported, isImportUpdated, isInDatabase, isLocked, isPersisted, isStrongLocked, lock, markNewImport, mergeHybridLink, mergeHybridLink, performCreate, performDelete, performUpdate, prepareUpdateContext, printDataName, printDisplayLinkEnd, printDisplayLinkStart, printDisplayLinkStart, printDisplayUrl, printDisplayUrl, putStrongLock, putStrongLock, releaseStrongLock, releaseStrongLock, removeAllRelatedData, removeAllRelatedData, removeExtraData, removeExtraDBData, removeExtraInfo, setAuthor, setAuthorDBID, setAuthorId, setBooleanFieldValue, setCategoryFieldValue, setDoubleFieldValue, setExtraData, setExtraDataMap, setExtraDBData, setExtraDBDataMap, setExtraDBDataMap, setExtraInfo, setFieldValue, setImportAuthor, setImportBatch, setImportDate, setImportDisplayUrl, setImportId, setImportMap, setImportMdate, setImportSignature, setImportSource, setImportSourceUrl, setImportUpdated, setIntFieldValue, setLongFieldValue, setMdate, setOpAuthor, setOpAuthorId, setOpDelegate, setRowId, unlock, unlock, unmarkNewImport, updateDisplayLinkHtmlAttributes, updateExtraDataMap, updateExtraDBDataMap, updateIndexTreeSetMethods inherited from class com.jalios.jstore.BasicStorable
clearId, compareTo, equals, getAttribute, getAttributes, getCdate, getCdateComparator, getDdate, getId, getIdComparator, getMdate, getMdateComparator, getStore, getUrid, hasBeenUpdated, hashCode, isStored, resetInternalCaches, resolveAtt, resolveVal, setAttributes, setAttributes, setDdate, setId, setStore, toXml
-
Field Details
-
SEP
- See Also:
-
DB_MESSAGE_ID
- See Also:
-
DB_MESSAGE_FROM
- See Also:
-
DB_MESSAGE_TO
- See Also:
-
DB_MESSAGE_CC
- See Also:
-
DB_MESSAGE_BCC
- See Also:
-
DB_MESSAGE_REPLYTO
- See Also:
-
DB_MESSAGE_INREPLYTO
- See Also:
-
DB_MESSAGE_REFERENCES
- See Also:
-
DB_MESSAGE_SUBJECT
- See Also:
-
DB_MESSAGE_ACCOUNT
- See Also:
-
DB_MESSAGE_THREAD
- See Also:
-
message
protected transient javax.mail.Message message -
receivedHeaders
-
multiparts
-
fileMap
-
duration
protected transient long duration -
ASCII_WIDTH
protected static final int ASCII_WIDTH- See Also:
-
-
Constructor Details
-
MailMessage
public MailMessage() -
MailMessage
-
MailMessage
-
MailMessage
- Throws:
IOExceptionjavax.mail.MessagingException
-
MailMessage
-
MailMessage
-
-
Method Details
-
getSubject
-
getOrigin
-
getFrom
-
getTo
-
getCc
-
getBcc
-
getReplyTo
-
getFromMember
-
getToMember
-
getToMember
-
getCcMember
-
getCcMember
-
getBccMember
-
getBccMember
-
getReplyToMember
-
getSenderMember
-
getAttachements
-
getAttachements
-
getContentText
-
getContentHtml
-
getAccount
-
getPriority
public int getPriority() -
getSentDate
-
getReceivedDate
-
getExpires
-
getMessageId
-
getInReplyTo
-
getReferences
-
getThread
-
getCustomBodyParts
public javax.mail.BodyPart[] getCustomBodyParts() -
setSubject
-
setOrigin
-
setFrom
-
setTo
-
setCc
-
setBcc
-
setReplyTo
-
setFromMember
-
setToMember
-
setCcMember
-
setBccMember
-
setReplyToMember
-
setAttachements
-
setContentText
-
setContentHtml
-
setAccount
-
setPriority
-
setSentDate
-
setReceivedDate
-
setExpires
-
setMessageId
-
setInReplyTo
-
setReferences
-
setThread
-
setCustomBodyParts
public void setCustomBodyParts(javax.mail.BodyPart[] v) -
setSendOneMailPerRecipient
public void setSendOneMailPerRecipient(boolean sendOneMailPerRecipient) Set sending mode, one mail for all recipients (false), or one mail for each recipients (true).Default is false, ie send one mail for all.
- Parameters:
sendOneMailPerRecipient- set to true to send one mail to each recipient, false to send one mail for all.- Since:
- jcms-6.1
-
setSendAcknowledge
public void setSendAcknowledge(boolean sendAcknowledge) Set whether acknowledge message should be sent at end of process. Default is false, ie no acknowledge is sent.- Parameters:
sendAcknowledge- the acknowledge message- Since:
- jcms-6.1
-
getFromIA
public javax.mail.internet.InternetAddress[] getFromIA() -
getToIA
public javax.mail.internet.InternetAddress[] getToIA() -
getCcIA
public javax.mail.internet.InternetAddress[] getCcIA() -
getBccIA
public javax.mail.internet.InternetAddress[] getBccIA() -
getReplyToIA
public javax.mail.internet.InternetAddress[] getReplyToIA() -
setTo
-
setCc
-
setBcc
-
setFrom
-
setTo
-
setCc
-
setBcc
-
setReplyTo
-
addTo
-
addCc
-
addBcc
-
addTo
-
addCc
-
addBcc
-
addTo
-
addCc
-
addBcc
-
addAttachements
-
addAttachements
-
getRecipient
- Returns:
- E-mails union of To, Cc, and Bcc fields.
-
getRecipientMember
- Returns:
- Members union of To, Cc, and Bcc fields.
-
getSendOneMailPerRecipient
public boolean getSendOneMailPerRecipient()Get sending mode, one mail for all recipients (false), or one mail for each recipients (true).Default is false, ie send one mail for all.
- Returns:
- true to send one mail to each recipient, false to send one mail for all.
- Since:
- jcms-6.1
-
getSendAcknowledge
public boolean getSendAcknowledge()Get whether acknowledge message should be sent at end of process. Default is false, ie no acknowledge is sent- Returns:
- true if acknowledge should be sent, false otherwise.
- Since:
- jcms-6.1
-
getAbstract
Returns an empty String.- Overrides:
getAbstractin classPublication- Parameters:
lang- the user language (ISO-639 language code)useDefault- should the default language be used- Returns:
- an empty String
- Since:
- jcms-9.0
- See Also:
-
getMatchingRecipient
Returns the address matching (indexOf) the given address in all recipient and members- Parameters:
address- to match- Returns:
- String the matching address or null
-
getMatchingRecipient
Returns the address matching the given pattern in all recipient and members- Parameters:
pattern- to match- Returns:
- String email
-
getFirstFromIA
public javax.mail.internet.InternetAddress getFirstFromIA()Resolve "From" from all froms and Member's from- Returns:
- InternetAddress from email
-
getFirstIA
-
getSingleRecipient
Returns the single Member recipients of the message or null if there is multiple recipients- Returns:
- Member the recipients
-
getIAQuietly
protected javax.mail.internet.InternetAddress[] getIAQuietly(Set<String> address, Set<Member> addressMember) Returns an array of InternetAddress joins of addresses and Member's addresses- Parameters:
address- Set of email addressaddressMember- Set of member- Returns:
- Array of InternetAddress
-
getAddressSet
Returns a Set of Address.toString()- Parameters:
ia- an array of Address- Returns:
- Set of String
-
getFirstAddress
Returns the first Address.toString()- Parameters:
ia- an array of Address- Returns:
- String the first address
-
setContentHtmlFromJsp
public MailMessage setContentHtmlFromJsp(String jspPath, Member loggedMember, String language, HashMap<Object, Object> requestAttribute, HashMap<Object, Object> sessionAttribute) Set the HTML text content of this MailMessage from the rendering of the specified jsp.- Parameters:
jspPath- a jsp path relative to the webapp root e.g"/custom/jcms/doNotificationText.jsp"loggedMember- the Member that will be set as the logged member when invoking jsplanguage- the language that will be set when invoking jsprequestAttribute- a HashMap of request attribute available to the jsp executionsessionAttribute- a HashMap of session attribute available to the jsp execution- Returns:
- this (for method chaining)
-
setContentTextFromJsp
public MailMessage setContentTextFromJsp(String jspPath, Member loggedMember, String language, HashMap<Object, Object> requestAttribute, HashMap<Object, Object> sessionAttribute) Set the plain text content of this MailMessage from the rendering of the specified jsp.- Parameters:
jspPath- a jsp path relative to the webapp root e.g"/custom/jcms/doNotificationText.jsp"loggedMember- the Member that will be set as the logged member when invoking jsplanguage- the language that will be set when invoking jsprequestAttribute- a HashMap of request attribute available to the jsp executionsessionAttribute- a HashMap of session attribute available to the jsp execution- Returns:
- this (for method chaining)
-
addHeader
-
getHeader
-
removeHeader
-
getHeadersMap
-
getTemporaryMessage
public javax.mail.Message getTemporaryMessage()Returns temporary javax.mail.Message store while fetching mail- Message might be null.
- Message fields calls can throw Exception if MailBox is closed. Try/Catch is strongly recommended.
- Returns:
- Message
-
getTemporaryMultiparts
Returns flatten collection of MailMessage.Part with decoded Files and Contents- Returns:
- MailMessage.Part
-
getTemporaryHeaders
Returns a temporary Map of all mail's header.- Returns:
- Map of String/Object
-
setMessage
Set fields for the given Message and download attachements in temporary folder Caller should also set:- Account setAccount()
- Author setAuthor()
- Parameters:
msg- the message- Throws:
javax.mail.MessagingException- if an error occursIOException- if an error occurs
-
performBeforeWrite
Description copied from class:DataCalled to perform some action before the write.- Overrides:
performBeforeWritein classPublication- Parameters:
op- the operation (OP_CREATE, OP_UPDATE, ...)mbr- the member which requests the write operationcontext- a map which contains context parameters (may be null)
-
getFileMap
Retrieve the Map of File/id to send in this MailMessage. The map is transient and never stored in the CMS- Returns:
- a Map with File as the key and an optional id as the value (may return null if no file was added yet).
-
addFile
Add a file to send with this MailMessage. The file never stored in the CMS- Parameters:
file- a File to send.- Returns:
- this (for method chaining)
-
addFile
Add a file to send with this MailMessage. The file never stored in the CMS- Parameters:
file- a File to send.id- an optional identifier for this file- Returns:
- this (for method chaining)
-
getDataHandler
protected javax.activation.DataHandler getDataHandler(File file) throws javax.mail.MessagingException Compute the correct handler to manage this file- Parameters:
file- theFileto add- Returns:
- the correct
DataHandler - Throws:
javax.mail.MessagingException- if any exception occurs
-
getDuration
public long getDuration()Retrieve the time the sending process took to execute.- Returns:
- a duration in millisecond (0 if sending did not occured yet)
-
send
public void send() throws javax.mail.MessagingExceptionSend this MailMessage.- Throws:
javax.mail.MessagingException- if an error occurs
-
send
Send this MailMessage.- Parameters:
ctxt- an optional context used to store information for this mail sending (context may be used by MailPolicyFilters in beforeSendMail and afterSensMail)- Throws:
javax.mail.MessagingException- if an error occurs- Since:
- jcms-6.1
-
sendInThread
public void sendInThread()Send this MailMessage in a seperate thread.- Since:
- jcms-6.1
-
sendInThread
Send this MailMessage in a seperate thread.- Parameters:
ctxt- an optional context used to store information for this mail sending (context may be used by MailPolicyFilters in beforeSendMail and afterSensMail)- Since:
- jcms-6.1
-
sendAcknowledge
protected void sendAcknowledge(Collection<MailMessage> successMessages, Collection<MailMessage> errorMessages) -
getTreeParent
Description copied from interface:TreeNodeReturns parent of the current node- Specified by:
getTreeParentin interfaceTreeNode- Overrides:
getTreeParentin classPublication- Returns:
- TreeNode parent Node
- See Also:
-
getTreeChildren
Description copied from interface:TreeNodeReturns a Collection of TreeNode children of the current node- Specified by:
getTreeChildrenin interfaceTreeNode- Overrides:
getTreeChildrenin classPublication- Returns:
- Collection of TreeNode
- See Also:
-
getMailMessageReplies
Returns a Collection of MailMessage replies of the current MailMessage- Returns:
- Collection of MailMessage
-
getMailMessageThread
Returns a Collection of MailMessage, thread of the current discussion in ascending order (oldest date first).- Default: Use inReplyTo field
- Use thread field if provided
- Returns:
- Collection of MailMessage
-
checkAuthKey
public boolean checkAuthKey()Returns true if the authkey contained in the localpart of the "to" field is consistent with the "from" field.- Returns:
- true if the authkey contained in the localpart of the "to" field is consistent with the "from" field.
- Since:
- jcms-8.0.0
-