The OUTPUT POST operator allows you to process a data stream from the input data bus into an email message that is sent to specified recipients. This operator can operate in two basic modes:
- sending a single email containing all data collected on the data bus,
- sending a separate email for each record present on the data bus.
Email recipients can be determined based on information contained in the input data bus or defined permanently, allowing for flexible management of message recipients.
An email message can be constructed using various data sources, including project parameters, data bus bits, and global parameters, enabling a high level of flexibility and content personalization. As a result, elements such as the subject, content, recipients, and other parts of the email can be built dynamically and tailored to the specifics of the processed data.
The operator also allows you to add attachments to the message. Attachments can originate from various sources:
- they can be sent directly as binary or text data contained in one of the data bus bits,
- or they can be generated from data bus data as files such as XLSX, CSV, or XML, which are then attached to the email message.
Thanks to these features, OUTPUT POST enables automated delivery of personalized notifications, reports, or summaries that can be sent directly from within the data processing workflow in the GRAVITY system. The operator is well suited for both simple notification scenarios and more advanced integration solutions, where email messages are part of an end-to-end business process.
Example of a GRAVITY project using the OUTPUT POST operator:
SELECTING AND CREATING AN EMAIL ACCOUNT
Go to the Email account tab in the operator properties.
If you already have an email account connection defined, select it from the Email account drop-down list; the connection fields will be populated according to the selected connection.
You can modify the email account connection details by clicking the Edit button.
If you do not yet have an email account connection defined in the system, you can add one using the Add button.
After entering the details of the new connection, you can test it using the Test sending button. If the configuration is correct, an email will be sent to the account used in the configuration.
You can save the connection in the system by clicking the Save button.
After saving, the connection will be available in the system under the name specified in the Name field.
OPERATOR BEHAVIOR CONFIGURATION
On the EMAIL PROPERTIES tab, you define the email delivery method, message recipients, and the system’s behavior in case of an error.
As the first step, specify how you want to send email correspondence.
The SEND MODE option:
- Single mail → a single email for the entire data bus data stream,
- Mail for each record → for each record in the data stream, the operator sends a separate email (as many emails are sent as there are records on the data bus).
These are two completely different ways of approaching a process using the OUTPUT POST operator. Both approaches can be extremely valuable for different types of processes.
You can send email either to predefined, fixed recipients (RECIPIENTS MODE = CONSTANT) or to an address provided on the input data bus (RECIPIENTS MODE = From Busbar).
When processing data in the OUTPUT POST operator, you may face a dilemma regarding how to handle data if an error occurs.
You can define this behavior by setting the Action after failed option to one of the following two modes:
- Continue processing → Error information will be visible in the execution logs, but it will not cause the process to stop, any transactions to be rolled back, or a processing error to be reported—the process will continue despite the send failure.
- Abort processing with error → The process will be stopped, initiated transactions will be rolled back, and a processing error will be reported.
In this mode, you can write information about the send status to the data bus (the Column for result status field).
The following status values are used:
SENT — the message was sent successfully.
FAIL — the message delivery failed.
as well as send details (the Column for result details field).
The value is an array of JSON objects storing delivery details for the recipients:
[{"Recipient":"piotr.piotrowski@company.com","Status":"SENT","StatusInt":1,"Details":"Sent"}]
The Recipient handling field controls how emails are sent to recipients. You can choose either Bulk sending or Individual for each recipient. When using bulk mode, an error (for example, related to one recipient’s domain) will cause email sending to stop for all recipients.
Because the SMTP server does not provide real-time delivery confirmation, the system can report only basic errors such as an invalid email address format, an invalid recipient server domain, etc. If the recipient’s server exists but the specified email address does not, the GRAVITY system cannot detect the error, because the recipient’s server does not report this information immediately and instead sends an asynchronous bounce-back email indicating that the specified recipient does not exist.
MESSAGE CONFIGURATION
On the Message tab, you define the subject and content of the email message and specify whether the email should be sent in HTML or TEXT format.
Both the subject (Subject) and the email content (Content) can be parameterized using data from the data bus, project parameters, and system variables.
To use a parameter in the Subject field, click the parameter insertion button, which opens the parameter selection window.
By expanding the list, you can choose from system parameters, project parameters, and data bus bits. Confirm your selection by clicking Insert.
To insert parameters into the Content field, expand the parameter list, select an item, and confirm the insertion by clicking the button marked in red in the screenshot below.
You can use project parameters, data bus data, and the GET_AGGR, function, which performs the specified aggregation on a selected data bus bit.
System parameters and data bus bits are inserted as text in the %name% format.
Project parameters are inserted as text in the @name format.
Data bus aggregation is inserted in the form GET_AGGR("SUM", "groupingField").
To make it easier to enter email content in the Content field when sending messages in HTML format (the Content is HTML switch), you can use the HTML editor button, which opens the HTML editor.
MESSAGE ATTACHMENT CONFIGURATION
On the Attachments tab, you can attach either the processed data stream as a file or a file created based on a data bus bit (this option is available only when Send mode=Mail for each record is selected).
To add an attachment based on the data bus stream, select the Attach all data as a file option and choose the format in which the data should be sent.
To add a file attachment based on a data bus bit that carries text or binary data, click Add attachment based on bit. Next, select the appropriate data bus bit (Source bit).
The file name (File name) can be parameterized in the same way as the message.
You can create any number of attachments based on the data bus.