Event action – Abstract
Purpose: Used to automatically create an e-mail object and/or send E-mails via the Lobster_pro server.
The E-Mail event action is used to automatically create and send E-mails via the Lobster_pro server. Dispatch requires the appropriate settings for the server configuration (see the section 'Necessary adjustments to the server configuration (startup.xml)' at the very bottom).
The content of the message (subject, mail body, attachments) and the addresses of the participants (sender, recipient, Cc, Bcc) can be defined statically via direct input as text or dynamically – i.e. via value resolvers. By default, many value resolvers take into account the reference object in the context of which the event action E-Mail is executed. The data of the reference object – if necessary together with other data sources – can be integrated into the E-Mail in various ways (Concat strings, Template, etc.).
Optionally, the created message can be saved (possibly depending on conditions) as an e-mail object (core:Mail, see E-mails) in Lobster_pro. Together with the information directly contained in the message (subject, mail body, sender/recipient addresses and attachments, if applicable), this also contains one field each for the 'creation log' (mailLog) and the 'state' (state, see Mail state), which are automatically assigned values by the event action E-Mail at runtime.
►NOTE◄ Access to e-mail objects does require sufficient role permissions and is tied to ownership or Company authorizations. However, the authorization to create e-mail objects through the event action E-Mail is always carried out without taking access restrictions into account. Provided that the selected Mail save mode allows for it, e-mail objects can therefore always be created regardless of the applicable logon context. The Company of session is automatically assigned as the owner of the e-mail object. If necessary, this assignment can be overridden by Run as by a static assignment from another company.
Requirements for sending e-mails
In order for Lobster Data Platform / Orchestration to send automated E-mails, access to an SMTP server must be guaranteed as a service for Lobster Data Platform / Integration.
As the following overview shows, this can be achieved in different ways:
|
|
E-mail settings under ‘StartupService’ (startup.xml)
The version of the configuration file ./etc/startup.xml provided during installation already contains an element with the com.ebd.util.net.mail.HubStartupConfiguration’ class, in which the specific details for the desired mail server access must be specified.
<
Call
name
=
"addApplication"
>
<
Arg
>
<
New
class
=
"com.ebd.util.net.mail.HubStartupConfiguration"
>
<
Call
name
=
"setMailSettings"
>
<!--SMTP via TLS should be used
<
Arg
>smtps</
Arg
>
-->
<
Arg
>localhost</
Arg
> <!-- server -->
<
Arg
type
=
"int"
>25</
Arg
> <!-- port -->
<
Arg
/> <!-- user -->
<
Arg
/> <!-- password -->
</
Call
>
<!-- or use mail channel instead
<
Call
name
=
"setMailChannel"
>
<
Arg
>PartnerName</
Arg
>
<
Arg
>ChannelName</
Arg
>
</
Call
>
-->
<!-- Uncomment the next line and set with fitting values to change the list of mechanisms to be used for authentication -->
<!--
<
Set
name
=
"sMTPAuthMechanisms"
>LOGIN PLAIN MD5-DIGEST NTLM</
Set
>
-->
</
New
>
</
Arg
>
</
Call
>
Configuration
Since the configuration for the E-Mail provides for more extensive configuration options, these are provided over different tabs in a Tab panel element.
The E-Mail tab combines parameters for sequence control with the configurations for the actual content of the message:
'E-Mail' tab/Parameters for sequence control |
|
The option Create mail content on commit is deselected by default (OFF), which causes all value resolvers in the E-Mail configuration to be processed immediately when the event action is executed.
The Send immediately option is deselected by default (OFF), which means that the mail is only sent when the current transaction is completed successfully (without error/rollback or a Abort). Depending on the selection for the option Create mail content on commit, value resolvers in the E-Mail configuration are processed immediately or only on commit.
If the ‘ID’ (id) of the generated email entity (see E-mails) is required for subsequent steps within event processing, this can be saved in a variable. For this purpose, the name of a variable must be entered in the Store Mail Id as a variable field. |
|
The selection for the Mail save mode defines whether and, if so, under which conditions the message is to be saved as an e-mail object when the event action E-Mail is executed. The creation of E-mails can be:
|
|
The selection for the Log level concerns the level of detail for the 'Creation log', which documents the processing steps of the event action E-Mail and is traceable from saved E-mails depending on the selection for the Mail save mode in the 'Creation log' (mailLog) field.
►NOTE◄ If the Mail save mode is set to 'Don't save mail', the Log level should be set to 'OFF' for optimal performance, otherwise the log will be created temporarily and then discarded. |
|
'E-Mail' tab/Parameters for mail content |
|
The text for the Subject of the e-mail is a required field. It can be defined either by direct input as static Text or – after clicking on the small grey arrow in the text field – as a return value from a value configuration (e.g. via the Value from localization value resolver). |
|
The Body content type parameter requires a static selection for the MIME type of the message body as a required field. Whether the selected type can be correctly displayed by a recipient ultimately depends on the mail client used. The field lists by auto-completion types can be interpreted by most mail programs. Alternative entries are possible, but are only useful as long as the mail client of the recipient also supports these formats. |
|
The Mail body builder parameter defines the body content of the e-mail as a string whose content should match the specified Body content type. The text for the mail body can be generated in different ways. The examples on the right demonstrate only a few selected procedures that can be used individually or in combination to systematically generate the 'appropriate' content for the message to be sent:
|
|
Tabs for defining addresses of 'participants' (sender/recipient) in the mail |
|
The From tab contains three parameters that can be used to send the e-mail in one of the two alternative ways (see ‘Requirements for sending e-mails’ above).
Initially, all three text fields always appear as required fields (see screenshot top right). The text can be defined either by direct input or – after clicking on the small grey arrow at the bottom left of the element – via a value configuration at runtime.
. |
Example 1: Sender address (From) as static text
Example 2: Sender address (From) with value configuration (Mail address user)
Example 3: Reference to a ‘Partner channel’ via Partner name and Channel name
|
The tabs Recipient, Cc (Recipient for copy) and Bcc (Recipient for blind copy) allow the specification of e-mail addresses for recipients of a message, which can be defined similarly to the From tab either as direct input or via value resolvers. While the sender (see From tab) of an e-mail must be uniquely determined by definition, multiple addresses can be specified for each recipient type. For this reason, a Repeatable element is offered for the address input, in which instances for the value assignment can be added and removed via the symbols Based on the value assignments for these instances, e-mail participants of the respective types ('To', 'Cc', 'Bcc') are generated for the message according to the following logic:
Examples (right):
|
Example: Direct input for multiple chained receivers
Example: Value resolver for recipient of a copy (Cc)
Example: Value resolver for receiver of a blind copy (Bcc)
|
'Attachments' tab/Parameters for mail attachment definition |
|||||||||||||||||
The Attachments tab provides a Repeatable element where parameters for one or more file attachments for the message can be defined. The
►NOTE◄ If the data object provided as content includes File name and/or MIME type specifications (see table below), these override the corresponding configuration parameters. This is especially helpful if the Content is defined via a value resolver such as Attached document which can return multiple contents.
►NOTE◄ The data type 'Action event content' is also suitable for creating a 'cover' for another content (e.g. text or byte array) via a Create instance, which can then be used to assign a File name and a MIME type. Examples:
|
Example: XML of the reference object (order) is attached as 'order.xml' file
Example: Documents related to the reference object are attached
|