Skip to content

Mails (EN)

mekor-dev edited this page Sep 29, 2020 · 2 revisions

Introduction

The platform send mail automatically by SMTP. The MailMessage system allow to customise the mail for a given recipient.

Important classes:

  • MailType : A type of mail to send
  • MailMessage : Store the message of a MailType for each locale. The message has parameters that the platform must replace.
  • MailService : Manage mails (configuration / building / sending)

MailMessage

For each type of mail to send, the MailMessage class defines a message for each locale For MailMessage, the MailMessageHTML table must be filled with HTML message of each locale

The message can contains parameters that will be replaced when building the mail. Parameters are surrounded by {}. Exemple: Hi {userName}, you account has been created !

Map<MailParam, String> params = new HashMap<>();
params.put(MailParam.USERNAME, user.getNickname());
sendMail(MailType.FORGOTTEN_PASSWORD, user, requestLocale, params);

Clone this wiki locally