Blueprint Developer Manual / Version 2010
Table Of ContentsSending emails is supported by Elastic Social and can easily be incorporated for common use cases in a project. Elastic Social provides listeners which can be implemented to send emails (see Elastic Social documentation).
In CoreMedia Blueprint, an example implementation and the
corresponding mail templates are provided. For example the
SendRegistrationMailListener
is a provided listener to send emails with a
link to confirm a registration.
The MailTemplateService
allows you to generate and send emails with a template name
and parameters.
In the provided implementation in Blueprint the template name
references a document in the CMS with content type CMMail
(email Template).
The parameters define variables which can be used in the mail templates. Locale specific mail templates are used if a locale specific variant is available (locale specific suffixed name).
Per default all properties of a CommunityUser
(the model for a user) are available
as variable in a mail template. For example you can use $givenName
to include the
given name of a user (if you use FreeMarker for templating as
CoreMedia Blueprint does). Additional parameters must be provided
programmatically by passing them as map additionalParameters
to the
MailTemplateService
.
In CoreMedia Blueprint, the following mail templates for the user and moderation processes are already provided with the example content. For each mail template, the template name and additional parameters are described.
If you want to use different additional parameters, redefine the variable in the mail template
and pass the corresponding parameter in the additionalParameters
map. All
properties of the CommunityUser
can be used in the templates without changing the
code.
Use case | Template Name | Additional Parameters |
---|---|---|
Registration | registration | baseUrl (registration activation link) |
User activated (premoderation) | userActivated
| N/A |
Reset Password | passwordreset
| baseUrl (reset password link) |
Profile Change | profileChanged
| N/A |
Comment Replied | commentReplied | replyText , replyAuthorName ,
replyDate , commentText ,
commentDate , commentUrl
|
Table 6.4. Mail Templates
Configuration
To enable email dispatch, the following configuration is needed:
At least one application node needs to be configured as worker node. For more information see configuration of
taskqueues.worker-node
in the Elastic Social Manual. In Blueprint, the elastic-worker-app is configured as worker node.The application context needs to be set up with implementations of specific beans (
JavaMailSender
andMailTemplateService
), more information is available in the Elastic Social Manual.The
mailSender
defined in Blueprint can be configured with the properties:elastic.social.mail.smtp.server
, default 'localhost'elastic.social.mail.smtp.port
, default 25elastic.social.mail.protocol
, default 'smtp'elastic.social.mail.username
, default '<empty>'elastic.social.mail.password
, default '<empty>'