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
1 ACCEPTED SOLUTION

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
2 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