Handler - EntityStateMail
EntityStateMail handler generates the user interface for viewing and sending e-mail. Typically, EntityStateMail handler is used in help desk incident templates. The format of the mail may depend on a selected mail template. This makes it possible to send differently formatted mails depending on receiver.
In order to send e-mail from Matrix42, you must define the mail-server settings in Platform settings.
Before starting configuration, give a code for the attribute. Otherwise the saving will fail. Do not reuse the attribute between several templates.
Configuring of this handler is different from other handlers. Most settings are configured in a separate configuration view, which opens up from the button in the metadata editor. With this mail template configuration, you can specify information that the EntityStateMail handler includes in the message automatically when opening a new message for composition or when replying to a received message. You can define, for example, a default mail subject, as well as recipient and sender information. In addition, you can also denote attributes whose values you want to include from the parent data card in the mail.
The following picture displays the appearance of an attribute with EntityStateMail handler. The second picture illustrates an example of an e-mail message based on a mail template which includes information that is denoted in the attribute metadata.
An attribute with EntityStateMail handler:

E-mail generated with the EntityStateMail handler:

You can insert email recipient addresses by typing to the 'To' field. Addresses are fetched from data cards based on configurations in platform settings.
By default listeners and handlers will be run after sending email from data card view. See metadata how to change this
Templates and attributes where the data is retrieved are defined by platform setting mail.addressbook.codes.
The following tables provide information on the attribute settings and metadata requirements for EntityStateMail handler. In addition, the table provides proposals for possible metadata values.
Table 1. Attribute Settings
| Handler name | Datatype |
|---|---|
EntityStateMail |
External reference |
Table 2. Optional Attribute Metadata
| Name | Value | Description |
|---|---|---|
Mail templates attribute |
attribute_code |
Attribute code of the attribute, which defines the list of mail templates used for pre-filling an email. If this settings is configured, mail template selection is done in this separate attribute. Note that it's possible to send email from data card view mode, but it's not possible to select the template. So mails sent in view mode use the value in the attribute. If the value is empty, the default mail template configuration is used. Attribute can be of any data type. Recommended data types are If this setting is not configured (default), mail template selection is done on the right side of the ' |
| Uploaded attachments attribute | attribute_code | Attribute code of the attribute whose value is to be updated, when an e-mail containing file attachments is sent. Attribute must be of data type externalReference. Attribute must be configured to use FileUpload. |
| Don't run listeners/handlers | [boolean] |
Determines if listeners and handlers should be skipped and should not run after sending email from data card view. Sent email and attachments will still be added to the data card even if listeners and handlers will be skipped. If the setting is not configured (default), listeners and handlers will not be skipped and will be run when email is sent from data card view. |
| Show as tabs | [boolean] |
Attributes using handlers with the metadata " NOTE: This setting applies only for the new Agent UI (2023) Determines whether the attribute with the The following criteria determines whether tabs are shown:
The default value of If the value of In case there is any attribute in between two or more attributes shown on tabs (attributes with |
The following picture describes EntityStateMail handler's mail template configuration screen. (To get to this screen, select the metadata and click the Edit button):

In first row, you can select a mail template to be edited. If Mail templates attribute is in use, the name must match with the values of the attribute, which was defined in meta data named Mail templates attribute. For creating a new configuration, select an empty slot for name. Then give a name for configuration. Finally press Save. If you want to change the name of a configuration, first select the wanted configuration. After that, write a new name in the "rename" field. At last, save the configuration. Now you can configure the mail template.
Next you will configure the outlook of the outgoing mail. You can define values for following fields and selections:
-
From(sender of the mail) -
From field editable(defines whether the contents of the From field can be edited when user is sending the message) -
To(receiver(s) of the mail) -
Cc(receiver(s) of a copy of the mail) -
Bcc(receiver(s) of a blind copy of the mail) -
Subject(title for the mail) -
Message(body contents of the mail) Attachment
You can choose attachments to be included in the outgoing mail. You can either upload a new file to be included, or add a reference to a file that has already been uploaded to Efecte. The reference has to contain a name of a file, that is located in the upload directory of Efecte.
- An example: add an attribute with
FileUploadhandler to the class holding the attribute withEntityStateMailhandler. Set the attribute code tojob_attachments. Now inEntityStateMailhandlers special configuration screen add an attachment reference with value $job_attachments$ and click "Add reference". After this, when you create a new mail using the configuration, files found in theFileUploadhandler created above will also be included in the mail as attachments.
Normally when you send an a-mail with attachments, the attached files are removed from the server as soon as the e-mail gets sent. With Uploaded attachments attribute meta data you can choose to save the attachments in an attribute of your choice.
It is only possible to save attachments that where explicitly added by the user. This does not affect attachments added with mail template configuration. The attachments configured in mail template are also never removed automatically.
- An example: add an attribute with
FileUploadhandler to the class holding the attribute withEntityStateMailhandler. Set the attribute code forUploaded attachments attributetosaved_attachments. After this, when you create a new mail using the configuration, files that you explicitly added to the mail will be stored as values of the attribute with codesaved_attachments.
All the fields listed above may contain hard coded text and values of the attributes of the data card. The values of the data card is entered as $attribute_code$. The fields can also contain values, which are retrieved from the referred data card.
- An example: let's assume that the template contains field $client$. The template of $
client$ contains field $email$. You can get the client's email by using value $client:email$. Or, if the $client$ template contains reference attribute $contact_user$, you can use value $client:contact_user:email$.
If you need some values to be URL encoded, you may use $[URL]attribute_code$. In addition to URL encoding, it makes static values to be printed as ID-numbers of the selected value.
In the last row of configuration view, you can select which attribute is used as Tracking attribute. This attribute is used by MailTask to match incoming reply-mails to existing data cards. Then you can select, whether the original mail(s) is appended to reply. And with the last option you can select whether the outgoing mail format is plain text or html. If your mail template contains HTML tags, select "html". Otherwise select "plain".
When user is viewing an email potential html part is shown. If html part is not found plain text part will be displayed. Following table provides information about Platform Setting affecting the mail viewing.
Table 3. Platform Settings
| Name | Value | Description |
|---|---|---|
|
|
[true | false] |
NOTE: This setting is not supported in ESM 2015 or newer releases. Remove the setting if it exists. If the value is set to |
mail.html.allowed.tags |
[list of html tags separated by comma (,)] | Allowed html tags in mail. Other tags will be removed because of security reasons. |
mail.html.allowed.attributes |
[list of html tags separated by comma (,)] | Allowed html attributes in mail. Other tags will be removed because of security reasons. |
You can find data cards containing read or unread mails by using the Advanced search conditions. Add a search condition for attribute with the EntityStateMail handler and you see the options for filtering data cards based on read or unread mails.
Table of Contents