tsendmail send same mail manytimes

Six Stars

tsendmail send same mail manytimes

I'm trying to join two tables and send the result of the join filtered in a tsendmail, Job below :

What I want to do is to send the rows collected in the same mail

Capture.PNG

 

My problems is that it's sending the same row many times.

 

Can you help solving this problem ?


Accepted Solutions
Thirteen Stars

Re: tsendmail send same mail manytimes

you can not use file in tJava (only file name)

in tJava you can use prepared variable (globalMap)

 

prepare file nd variables:

Screen Shot 2019-02-06 at 12.30.47 AM.png

 

send email with prepared text and attachments:

Screen Shot 2019-02-06 at 12.31.25 AM.png

-----------

All Replies
Thirteen Stars

Re: tsendmail send same mail manytimes

Hi

 

the simplest way - store all in csv file and run tsendmail as separate subjob connected by OnSubjobOk trigger with attachments

-----------
Six Stars

Re: tsendmail send same mail manytimes

Is it possible to clean the csv file each time the email is sent so we can send new rows after each execution ?

Thirteen Stars

Re: tsendmail send same mail manytimes

of course, just add after tSendMail -> OnSubJobOk -> tFileDelete

-----------
Five Stars

Re: tsendmail send same mail manytimes

Hi,

You can use tjavaflex just before tSendmail and save you rows from table in array and then using global variable you can print in under "Message box" in tSendmail component.

 

Regards,

Rahul

Six Stars

Re: tsendmail send same mail manytimes

@rahuljan  I'm using TjavaRow to read the output that I'm injecting in an HTML Code and then using the global variable to send the email.

 

Can I  declare the array in the same place and using it afterward or I need to move the code to the tjavaflex

Six Stars

Re: tsendmail send same mail manytimes

@vapukov I'm a bit confused, can you walk me through your suggestion?

Thirteen Stars

Re: tsendmail send same mail manytimes


@SwanGhazi wrote:

@vapukov I'm a bit confused, can you walk me through your suggestion?


what do you mean?

 

create file tFileOutputDelimited 

send file - tSendMail

delete file - tFileDelete

-----------
Five Stars

Re: tsendmail send same mail manytimes

Yes you to save everything in array before.

Six Stars

Re: tsendmail send same mail manytimes

@vapukov  I should create that file before tjavaRow right ?

Thirteen Stars

Re: tsendmail send same mail manytimes


@SwanGhazi wrote:

@vapukov  I should create that file before tjavaRow right ?


"
- Doctor, could you recommend for me a best medication to prevent a baby?
- glass of water
- wow!!! should I use it before sex or after?
- instead of!
"

:-)

 

btw, I don't know - what are you doing in tJavaRow, but tFileOutputDelimited - must be the last in subjob, it and create the file and populate it with data

1 st subjob (group of components in Talend terms) - preparing data and store it in file or variable (if not too big)

2nd subjob - send it

3rd - cleanup (delete file)

 

-----------
Six Stars

Re: tsendmail send same mail manytimes

@vapukov  I've mentioned in a previous comment that I'm using TjavaRow to embed the output of the tmap in an HTML code and put the result in a global variable that I call in my tsendmail 

Thirteen Stars

Re: tsendmail send same mail manytimes

it is simple, it is just separate and independent processes:

 

  • prepare csv file, nothing about HTML - read from DB all what must be sent, save it to file
  • send eMail, here - prepare text (in your case tJava)
  • cleanup - delete csv file after sending

 

cheers

-----------
Six Stars

Re: tsendmail send same mail manytimes

@vapukov  can you assist me here to use the tFileOutputDelimited to put the date in my tjava ? 

Thirteen Stars

Re: tsendmail send same mail manytimes

you can not use file in tJava (only file name)

in tJava you can use prepared variable (globalMap)

 

prepare file nd variables:

Screen Shot 2019-02-06 at 12.30.47 AM.png

 

send email with prepared text and attachments:

Screen Shot 2019-02-06 at 12.31.25 AM.png

-----------
Six Stars

Re: tsendmail send same mail manytimes

@vapukov  I've just understood what you meant by the file Smiley Very Happy 

 I'm so sorry took a lot of time to get you! I'm just having a problem that the mail is sent many time how can i prevent that ?

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.