Talend ETL has
given a very simple interface and availability to everyone to manage
the data and apply transformation as needed. In this blog we are going to
discus about a very useful example of Bulk Mail.
If
you want to send multiple emails and you have data ready with you like receiver
address, message for the receiver, your SMTP setting than one can easily
send multiple emails in one go.
Suppose
you want to send a intimation to your customer for pending amounts
and you have few customer than it is simple possible with your mailbox, but if
you have thousands of customer and have to send amount information to related
to that customer only than talend with help you simply
using tSendMail component.
Case:
For example you have customer info like Customer Number(CNO), customer
name(CNAME), cusomer mail id(EMAIL), pending amount( AMT), Message(MSG)[Its is
an concatenation of CNO, CNAME, AMT with your message
body] in XLS doc of any database table then you can
process it by talend.
In
this example we are taking XLS doc as data source.
| Sample Doc |
Steps
are following
- Create
a metadata for XLS file.
XLS file metadata - Create a new job.
- Place tFileInputExcel component,
open basic setting, chose property type Repository and select your XLS
metadata from available XLS. In this example EMAIL is our Excel file. Define
metadata in built in properties also available in same component.
tFileInputExcel Basic settings - Next
we have to add tSetGlobalVar for create global variables which we are
going to use in tSendMail component. In the basic setting of
the component we have to define key and value pair. In this example I
am using same variable name as column name. One can use any name for variable.
For setting the name Key is the name of variable and the Value is
define the value to that variable. One can also hardcode the values,
but in over case we are going to assign first row of XLS doc. For that
we can use a row name coming from XLS component, here we can see
this it is “row1”, so we can assign variable “CNO” value as row1.CNO and so on.
tSetGlobalVar Basic Setting - For printing the variable values I used tlogrow component, which is not going to perform any important role in this job, one can also skip the component.
- At
last connect tSendmail component and go to the basic settings.

tSendMail Settings (a) - TO>> Assign the value of global variable EMAIL like ((String)globalMap.get("EMAIL"))
- From>> Your Mail address
- If you want to show sender name to the receiver than you can hardcoded the values.
- Cc>> Any email ID if you need for verification.
- SUBJECT>> Subject line of your mail
- MESSAGE>> Assign the message values from
variable MSG like ((String)globalMap.get("MSG"))

tSendMail Settings (b) - SMTP Host>> One can use their SMTP setting, for example I am simply using my Gmail which has Host Name as "smtp.gmail.com".
- SMTP port>> Port no of host, for Gmail it is 587 for outgoing mail.
- Enable STARTTLS support.
- Use you ID and password in between “”
- All set for run the job