close

Filter

loading table of contents...

Blueprint Developer Manual / Version 2301

Table Of Contents

6.3.4 Emails

Sending 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 content item 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.

Mail Templates
Use caseTemplate NameAdditional Parameters
RegistrationregistrationbaseUrl (registration activation link)
User activated (premoderation)userActivated N/A
Reset Passwordpasswordreset baseUrl (reset password link)
Profile ChangeprofileChanged N/A
Comment RepliedcommentReplied 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 and MailTemplateService), 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 25

    elastic.social.mail.protocol, default 'smtp'

    elastic.social.mail.username, default '<empty>'

    elastic.social.mail.password, default '<empty>'

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.