[resolved] tSendMail dynamic message

Highlighted
One Star

[resolved] tSendMail dynamic message

Hello!
i want tSendMail with a dynamic message.
I have a text in a file, and i want send it with tSendMail.
I try with tFileInputDelimited, but it send an email for each lines of my file, but i want only one email with all lines of my file.
Someone know how to do?
(sorry maybe my english is not very goodSmiley Happy )
Thx

Accepted Solutions
Community Manager

Re: [resolved] tSendMail dynamic message

Hi
Use a tFileInputFullRow to read the file line by line, concatenate all lines with separator "\n" and store the result to a context variable on tJava, the job design is read as below:
tFileInputFullRow--main--tJavaRow
|
onsubjobok
|
tSendMail
Open the Context view and define a variable, name it as "message" for example, and set its default values as "".
on tJavaRow:
if(context.message.equals("")){
context.message=input_row.line;
}else{
context.message=context.message+"\n"+input_row.line;
}
On tSendMail, set the Message field with context variable, for example:
"The file content is: "+context.message
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

All Replies
Community Manager

Re: [resolved] tSendMail dynamic message

Hi
Use a tFileInputFullRow to read the file line by line, concatenate all lines with separator "\n" and store the result to a context variable on tJava, the job design is read as below:
tFileInputFullRow--main--tJavaRow
|
onsubjobok
|
tSendMail
Open the Context view and define a variable, name it as "message" for example, and set its default values as "".
on tJavaRow:
if(context.message.equals("")){
context.message=input_row.line;
}else{
context.message=context.message+"\n"+input_row.line;
}
On tSendMail, set the Message field with context variable, for example:
"The file content is: "+context.message
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] tSendMail dynamic message

Thank you,
i just test it works good Smiley Happy

Cloud Free Trial

Try Talend Cloud free for 30 days.

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.