Emailing 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).
The MailTemplateService
allows you to generate and send emails with a template name
and parameters.
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 |
---|---|---|
Reset Password | passwordreset | baseUrl (reset password link) |
Comment Replied | commentReplied | replyText , replyAuthorName ,
replyDate , commentText ,
commentDate , commentUrl |
Table 8.6. Mail Templates