Sending E-mails from Data Transformation (Part 1)

If you ever have a situation where you need to send an email from your data transformation, CloverETL gives you several options to do it. If you need to monitor your transformation’s health and status, you would be better off with CloverETL Server, which offers plenty of monitoring and reporting features. These can be hooked to an “e-mail” action which sends you e-mail alerts based on predefined rules. This is very useful feature in an enterprise environment. We will hopefully cover these options in some later posts.

Today, I would like to focus on simpler, yet powerful way of sending e-mail messages from CloverETL – sending them directly from the transformation graph. You use a dedicated component – the EmailSender – to send e-mail messages from inside a graph.

The component falls into writers category which suggests that it can take data on the input and output it somewhere. In this case, it puts it into an e-mail message. You can map your input onto any aspect of the message – from “To”, “Cc”, “Subject”, etc. to the message body or as an attachment(s). EmailSender reads input records and for each one it composes and sends out a single e-mail message.

A small, but quite nice feature is that you don’t need to map all message properties to your input. You need to prepare only such parts that vary with each record and leave the rest to defaults or set up parameters for it. For example, if you want to compose your message body from data input records but want the message recipient to be fixed, you can use a parameter for “To” and keep it separate from data records.

Basic setup of EmailSender requires setting basic parameters for SMTP – host, and username and password if required. You can also setup SSL and TLS if the server supports it.

Please note, that it is a common CloverETL approach to use parameters to pass sensitive data – password in this case (see screenshot).

Let’s now take a peek at setting the actual message composition and the mapping onto input – the Message attribute. It opens an editor which displays message headers and your input.

The mapping is actually extremely simple – you use fields from your input as variables to fill in the values. Each field is used as $field (see use of $text in MessageBody). Also note the Alternative column – for records where the “text” field in the example has an empty value, this alternative value will be used (can be constant or defined in a parameter).

You can even combine several fields into one to form (any) text – not only in message body, but also “Subject”, “To”, etc.

If you need a more advanced approach, you can use the “+” button to add additional keys and values. They are passed as-is to your e-mail message as extra headers (e.g. for “X-Mailer: CloverETL” you set key Name to “X-Mailer” and set its Value to “CloverETL”).

That’s all for now, hope you will find many cases where you find this component to be a useful tool.

Also, wait for my next post where I explain how you can use EmailSender to send messages with attachments!

 

One thought on “Sending E-mails from Data Transformation (Part 1)

  1. Pingback: Sending E-mails from CloverETL (2) Attachments « CloverETL's Blog

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>