How to customize system mails

The application sends different emails, for example:

  1. email address verification during account creation or changing an email address
  2. providing a code as a second factor at login
  3. login without a password in the account
  4. login while password is forgotten (password reset)
  5. providing a link after 5 failed login attempts
  6. changing a password when it is expired
  7. changing a password because it is not strong enough
  8. providing a single-use login code (beta)
  9. providing a link as a second factor for forms with permission settings

These emails contain a piece of text combined with a link or a code.

We will explain how to customize these emails.

 

The from address 

You can set the from address in two ways.

  1. The simplest way is to set the from address in the blueprint properties on the tab 'General'. If needed you can add a velocity script for dynamic behavior.

  2. If you want to use different from addresses in different database instances, you can set the from address in the application settings. At this moment you can not add a velocity script in the application settings. 

 

The subject

The text in the subject is defined by a label code. If needed, you can add a custom label. You can also use a velocity script for dynamic behavior. See below for more details.

The surrounding page of the body

A system mail gets a default surrounding page.

<html>
    <body>
        $document.getContent()
    </body>
</html>

 From UIV 4.0 the system mails will get an improved default surrounding page.  

You can add your own surrounding page in the blueprint properties on the tab "User Interface". See below for more details.

 

The content of the body

The text in the body is defined by a label code. If needed you can add a custom label. You can also use a velocity script for dynamic behavior. See below for more details.

 

About label codes

 

These are the label codes 

    ​

Situation Subject Body
A. email address verification account system__account email verification subject *

account system__email body salutation

account system__email address confirmation mail - default body

+

confirm email address (label on button)

B. providing a login code as a second factor account system__two factor login code email subject account system__two factor login code body 
C. no password in account account system__passwordUrlEmailSubject * account system__passwordUrlEmailBody *
D. password reset account system__passwordUrlEmailSubject * account system__passwordUrlEmailBody *
E. 5 failed login attemps account system__passwordUrlEmailSubject * account system__passwordUrlEmailBody *
F. changing an expired password account system__passwordUrlEmailSubject * account system__passwordUrlEmailBody *
G. password not string enough account system__passwordUrlEmailSubject * account system__passwordUrlEmailBody *
H. single-use login code no label code yet no label code yet
I. providing a link for forms with permission settings access permission.email subject * access permission.email body *

 

For the label codes in the blue fonts (marker with a *) you can add your own labels in the blueprint.

About velocity

If you use a velocity script, the current service is always available in the velocity context. When you want to use the service to get customized behavior, you should never use the toString representation of the service for your logic. For example, when the service is a ClazzManager or a RecordManager, use getClazz() and getIdentifier().

#set($clazz = $service.getClazz())
#set($clazzIdentifier = $clazz.getIdentifier())
#if($clazzIdentifier == "D1")
    do this
#else
    do that
#end