Skip to main content
Skip table of contents

Customise Email Templates

The user registration system is supplied with default content for the email messages it sends, but it is likely you will want to modify the contents to suit your own branding and messaging. You can also provide email templates in multiple languages if necessary.

There are three emails sent by the user registration system:

VerifySent on initial registration, to verify the user's email address. When the user clicks the link they will be prompted to create a password and complete the registration process.
Password ResetSent when a user uses the forgot password option. When the user clicks the link they will be able to choose a new password for their account.
Re-RegisterSent if a user attempts to register a new account with an email address that is already registered. This email offers the user the chance to reset their password if they have forgotten it.

All of the settings related to templates are configured in configuration server. Use the following command to check the current settings:

CODE
cfg global superadmin.selfreg.email

Multilingual Support

The email template system is designed to support multiple languages for emails. The language sent to an individual who is registering will be based on the Accept-Language header sent by the user's web browser.

Configure Multiple Languages for Templates

For each language you want to support, you must provide the translated message contents under the following key in SuperADMIN:

CODE
cfg global superadmin.selfreg.email.localized.<lang>

Where <lang> is either a two character ISO 639-1 language code or a language code followed by a hyphen and a two character ISO 3166 country code. For example

  • en
  • de
  • de-AT

See below for the details of the individual elements you need to provide for each language.

Set the Default Language

If none of the languages requested by the user's browser are available, then the default language will be used. To change the default language, use the following command in SuperADMIN:

CODE
cfg global superadmin.selfreg.email.defaultLanguage set <lang>

Replace <lang> with the appropriate language code, enclosed in double quotes, which must match one of your defined template languages. For example:

CODE
cfg global superadmin.selfreg.email.defaultLanguage set "en"

Email Format

Email messages can be sent in HTML, plain text, or both. Use the following command in SuperADMIN to change the setting:

CODE
cfg global superadmin.selfreg.email.format set <format>

Replace <format> with either htmlplainText or both, enclosed in double quotes. For example:

CODE
cfg global superadmin.selfreg.email.format set "html"
Make sure you provide all the relevant templates in all the languages you want to support. For example if you set the email format to both then you must provide both plain text and HTML format templates for all supported languages.

Global Template

All messages use a global template. This is where you set the main template branding, such as headers, footers and any images or logos you want to include.

Set the global templates in SuperADMIN using the following command:

CODE
cfg global superadmin.selfreg.email.localized.<lang>.template set <htmltemplate>
cfg global superadmin.selfreg.email.localized.<lang>.plainTemplate set <plaintexttemplate>

Replace <htmltemplate> with your global HTML template, enclosed in double quotes, and replace <plaintexttemplate> with your global plain text template. Each template must include the string {message} somewhere in the body. This will be replaced with the contents of the actual message.

In addition, you will need to escape any double quotes within your template with a preceding backslash: \

The following examples define global templates for English language messages. In this case the plain text template has been set to just the body of each individual message type:

CODE
cfg global superadmin.selfreg.email.localized.en.template set "<html><body style=\"font-family: Helvetica, Calibri, Verdana, sans-serif\"><p><img src=\"https://spacetimeresearch.com/email/str.png\" width=\"151\" height=\"65\" alt=\"Space-Time Research Logo\"/></p>{message}</body></html>"

cfg global superadmin.selfreg.email.localized.en.plainTemplate set "{message}"

Individual Message Templates

Set the individual message templates using the following SuperADMIN commands:

CommandSets...
cfg global superadmin.selfreg.email.localized.<lang>.verify.message set <message>
The HTML message contents for the initial verification email.
cfg global superadmin.selfreg.email.localized.<lang>.verify.plainMessage set <message>
The plain text message contents for the initial verification email.
cfg global superadmin.selfreg.email.localized.<lang>.verify.subject set <subject>
The subject line for the initial verification email.
cfg global superadmin.selfreg.email.localized.<lang>.passwordReset.message set <message>
The HTML message contents for password resets.
cfg global superadmin.selfreg.email.localized.<lang>.passwordReset.plainMessage set <message>
The plain text message contents for password resets.
cfg global superadmin.selfreg.email.localized.<lang>.passwordReset.subject set <subject>
The subject line for password resets.
cfg global superadmin.selfreg.email.localized.<lang>.reRegister.message set <message>
The HTML message sent when someone tries to register with an address that is already registered.
cfg global superadmin.selfreg.email.localized.<lang>.reRegister.plainMessage set <message>
The plain text message sent when someone tries to register with an address that is already registered.
cfg global superadmin.selfreg.email.localized.<lang>.reRegister.subject set <subject>
The subject line used when someone tries to register with an address that is already registered.

In each case:

  • Replace <lang> with the language code.
  • Replace <message><subject> with your message/subject, enclosed in double quotes.
  • Make sure you escape any double quotes in the contents with a preceding backslash (\).

In addition, your messages should use the following codes somewhere within the message body:

CodeUsed In...
{link}
  • Verify messages – a link to verify the email account
  • Password reset – a link to reset the user's password
  • Re-Register – a link to reset the user's password
{rejectLink}
  • Verify messages – allows the user to reject the registration and stop receiving additional messages from user registration (for example because someone else is repeatedly trying to register an account with that user's email address).
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.