In SQLMessenger, you can add files with fixed content as attachments to a task. The files can be of any type, such as Word documents, PDFs, images, or other formats. After the task is completed, SQLMessenger will send these files as attachments in the emails generated by the task.

Add Fixed-Content attachment to a task

The Fixed-Content attachment config dialog
In this dialog box:
File Source |
Select the file source. The file can be a specific file specified during task configuration, or it can be a variable, allowing different files to be sent based on the variable's value during task execution. Additionally, you can retrieve file data from a database as the file source. For example, if the variable's value is "D:\Document\Report.PDF," SQLMessenger will add the "D:\Document\Report.PDF" file as an attachment to the email and send it to the recipient. When retrieving file data from a database, SQLMessenger will extract the target file data stored in the database, convert it to a readable file format, and attach it to the email for sending. |
File Name / Variable Name |
Select the file to attach, or choose a variable to dynamically generate the filename. |
Add passwords and watermarks (PDF file only) |
If the attachment is a PDF document, you can add a watermark to the PDF and set a management password and access password during task execution. Note: If the file has been added with an access password, this option cannot be used anymore. Otherwise, the task will fail. |
Do not send this file when sending message through Slack API |
If this option is selected, the task will not send the file to Slack workspace members via the Slack API. |
Ignore this attachment if the variable is null/empty |
When the File Source is set to Variable-Based filename, if this option is enabled and the variable value is null or empty, the system will skip this attachment. If this option is not selected, the task will fail and abort. |
Template disabled |
If this option is selected, the attachment will not be processed during task execution, nor will it be sent to the recipient. |
Starting with SQLMessenger 2.4, you can read file data from databases, retrieve the files to be sent, and attach them as email attachments.
Step 1: In the Fixed-Content attachment config dialog, select "Read from database" for "File Source", then click the "Edit SQL Query" button.

Step 2: Select the data source where the file is located and enter the query statement.

Note:
(1) Your query statement must return the following fields:
_$file_name$_: Represents the name of the file to be sent. For example, "chart.png" or "report.pdf".
_$file_data$_: Represents the data of the file to be sent. This field must be a binary data field, for example, in SQLServer, the _$file_data$_ field must be a varbinary or a field with similar functionality.
You can use the "AS" keyword in the SQL query to rename the corresponding fields in your data table to the above two field names. For example:
(2) If the statement returns multiple records, the data of each record will be added as a separate attachment file.

SQL query results

After the task runs, the queried data are added as attachments