Package org.opencms.notification
Class A_CmsNotification
java.lang.Object
org.apache.commons.mail.Email
org.apache.commons.mail.MultiPartEmail
org.apache.commons.mail.HtmlEmail
org.opencms.mail.CmsHtmlMail
org.opencms.notification.A_CmsNotification
- Direct Known Subclasses:
CmsContentNotification
,CmsPasswordChangeNotification
,CmsPublishNotification
,CmsSendPasswordNotification
,CmsWorkflowNotification
Abstract class to create a notfication which will be send as a html mail to
a user in OpenCms.
- Since:
- 6.5.3
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Path to optional config file containing header and footer.static final String
Separator between header and footer in optional config file.protected CmsObject
The CmsObject.protected String
The configured footer.protected String
The configured header.protected Locale
The locale of the receiver of the content notification.protected CmsNotificationMacroResolver
The macro resolver used.protected CmsXmlContent
The xml-content to read subject, header and footer of the notification.static final String
ID of the system mail host.Fields inherited from class org.apache.commons.mail.HtmlEmail
CID_LENGTH, html, inlineEmbeds, inlineImages, text
Fields inherited from class org.apache.commons.mail.Email
ATTACHMENTS, authenticator, bccList, bounceAddress, ccList, charset, content, CONTENT_TYPE, contentType, debug, EMAIL_BODY, EMAIL_SUBJECT, emailBody, FILE_SERVER, fromAddress, headers, hostName, ISO_8859_1, KOI8_R, MAIL_DEBUG, MAIL_HOST, MAIL_PORT, MAIL_SMTP_AUTH, MAIL_SMTP_CONNECTIONTIMEOUT, MAIL_SMTP_FROM, MAIL_SMTP_PASSWORD, MAIL_SMTP_SOCKET_FACTORY_CLASS, MAIL_SMTP_SOCKET_FACTORY_FALLBACK, MAIL_SMTP_SOCKET_FACTORY_PORT, MAIL_SMTP_TIMEOUT, MAIL_SMTP_USER, MAIL_TRANSPORT_PROTOCOL, MAIL_TRANSPORT_TLS, message, popBeforeSmtp, popHost, popPassword, popUsername, RECEIVER_EMAIL, RECEIVER_NAME, replyList, SENDER_EMAIL, SENDER_NAME, sentDate, SMTP, smtpPort, socketConnectionTimeout, socketTimeout, ssl, sslSmtpPort, subject, TEXT_HTML, TEXT_PLAIN, tls, toList, US_ASCII
-
Constructor Summary
ConstructorDescriptionA_CmsNotification
(CmsObject cms, CmsUser receiver) Creates a new A_CmsNotification. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a new macro to the used macro resolver.protected void
appendHtmlHeader
(StringBuffer buffer) Append the html-code to start a html mail message to the given buffer.protected void
Append XMLContent to StringBuffer.protected void
appenHtmlFooter
(StringBuffer buffer) Append the html-code to finish a html mail message to the given buffer.protected abstract String
Overwrite the method to generate the message body of the notification.Returns the CmsObject.Returns the locale.protected abstract String
Overwrite the method to return the path to the xmlcontent, where the subject, the header and the footer are defined.Returns the receiver.send()
Methods inherited from class org.apache.commons.mail.HtmlEmail
buildMimeMessage, embed, embed, embed, embed, embed, embed, setHtmlMsg, setMsg, setTextMsg
Methods inherited from class org.apache.commons.mail.MultiPartEmail
addPart, addPart, addPart, attach, attach, attach, attach, attach, attach, createBodyPart, createMimeMultipart, getContainer, getPrimaryBodyPart, getSubType, init, isBoolHasAttachments, isInitialized, setBoolHasAttachments, setInitialized, setSubType
Methods inherited from class org.apache.commons.mail.Email
addBcc, addBcc, addBcc, addBcc, addCc, addCc, addCc, addCc, addHeader, addReplyTo, addReplyTo, addReplyTo, addTo, addTo, addTo, addTo, createMimeMessage, getBccAddresses, getBounceAddress, getCcAddresses, getFromAddress, getHeader, getHeaders, getHostName, getMailSession, getMimeMessage, getReplyToAddresses, getSentDate, getSmtpPort, getSocketConnectionTimeout, getSocketTimeout, getSslSmtpPort, getSubject, getToAddresses, isSendPartial, isSSL, isSSLCheckServerIdentity, isSSLOnConnect, isStartTLSEnabled, isStartTLSRequired, isTLS, sendMimeMessage, setAuthentication, setAuthenticator, setBcc, setBounceAddress, setCc, setCharset, setContent, setContent, setDebug, setFrom, setFrom, setFrom, setHeaders, setHostName, setMailSession, setMailSessionFromJNDI, setPopBeforeSmtp, setReplyTo, setSendPartial, setSentDate, setSmtpPort, setSocketConnectionTimeout, setSocketTimeout, setSSL, setSSLCheckServerIdentity, setSSLOnConnect, setSslSmtpPort, setStartTLSEnabled, setStartTLSRequired, setSubject, setTLS, setTo, toInternetAddressArray, updateContentType
-
Field Details
-
SYSTEM_MAIL_HOST
ID of the system mail host.- See Also:
-
HEADER_FOOTER_CONFIG_PATH
Path to optional config file containing header and footer.- See Also:
-
HEADER_FOOTER_SEPARATOR
Separator between header and footer in optional config file. -
m_configuredHeader
The configured header. -
m_mailContent
The xml-content to read subject, header and footer of the notification. -
m_cms
The CmsObject. -
m_locale
The locale of the receiver of the content notification. -
m_macroResolver
The macro resolver used.
-
-
Constructor Details
-
A_CmsNotification
Creates a new A_CmsNotification.- Parameters:
cms
- the cms object to usereceiver
- the receiver of the notification
-
-
Method Details
-
addMacro
Adds a new macro to the used macro resolver. Macros are used for the xml content file.- Parameters:
key
- The key of the macro.value
- The value of the macro.
-
getCmsObject
Returns the CmsObject.- Returns:
- the CmsObject
-
getLocale
Returns the locale.- Returns:
- the locale
-
getReceiver
Returns the receiver.- Returns:
- the receiver
-
send
- Overrides:
send
in classorg.apache.commons.mail.Email
- Throws:
org.apache.commons.mail.EmailException
- See Also:
-
Email.send()
-
appendHtmlHeader
Append the html-code to start a html mail message to the given buffer.- Parameters:
buffer
- The StringBuffer to add the html code to.
-
appendXMLContent
Append XMLContent to StringBuffer.- Parameters:
msg
- StringBuffer
-
generateHtmlMsg
Overwrite the method to generate the message body of the notification. This text is placed between the header and the footer of the defined xmlcontent and the required html code is added.- Returns:
- The text to be inserted in the notification.
-
getNotificationContent
Overwrite the method to return the path to the xmlcontent, where the subject, the header and the footer are defined.- Returns:
- The path to the xmlcontent file.
-