In my previous post I talked about using the EmailSender component featured in CloverETL 2.8 and later to send messages from inside a running transformation graph. EmailSender is used in cases when you need to compose a message from the data that you process in your graph. For example, bulk mailing computed reports, reporting faulty data to administrators, etc. Read my previous post on EmailSender to learn the basics.
In this post, I will focus just on composing messages with attachments using CloverETL’s EmailSender component.
You can add as many attachments to your message as you want. Any attachment can be, as everything in EmailSender, either taken from your input data record or passed as a parameter or static text.
EmailSender distinguishes between two kinds of attachments – files (on the computer where the transformation runs) and data attachments.
File attachments work as one would expect – the file is read from your local computer and attached to the message. In CloverETL you can choose how you specify the file name – either pick a static path or you pass it in the input data record.
Data attachments are composed directly from data coming to the input of EmailSender. This way you can assemble for example XML file attachments, texts and even binary attachments. Obviously, in such case you need to specify additional information so that EmailSender knows how to send your data – specifically its mime type and the attachment name.
To start with attachments, open the EmailSender edit dialog and go to the “Attachments” attribute editor.
The easiest way to add an attachment is to use the “->” button or drag&drop from Fields to Attachments.
This way you create a file attachment whose path is passed from an input data record (in field “attchFile” in the example above). Please notice the description column which tells you how the attachment will be handled.
You can also add a new attachment using the “+” button and then editing the newly created item with the “…” editor button (you may find this a bit confusing at first – just hit the the plus “+” button and a new line in the Attachments table appears. Then click in the first column of the new row and click the three-dot edit button “…” – and bingo, you’re there!).
In the dialog, you can either browse for a local file or pick a field to use as file name. Notice the screenshot – I can even use the field as just a part of some predefined path. This allows me to compose the attachment path from static path, field value or even parameters (the full example might look like “${PROJECT}attachments$attchFile”).
Data attachments can be defined with the last option – Attachment data from record. Simply pick the field where your attachment data will be, then specify the attachment name and mime type – both can again be either taken from a field or static. See the following screenshot to get the hang of it.
That’s it! You can now send attachments with CloverETL’s EmailSender. Just always remember, that you can set any value to either constant, parameter or field value using the $field notation. With this in mind, you can set up pretty much everything you’ll ever need.








