tSendMail to multiple recipients get from table

Five Stars

tSendMail to multiple recipients get from table

Hi,

 

I have a job design which works good for single email, but now i have a table for emails and need to get those emails and send report to that list. This table don't have directly link with the report tMap_1. Like this is separate source and not link with report data. Below is job design, Please advise which component i should use to complete this. I am using MySQL Database.

Screenshot_1.jpg

 

 

 

Tags (1)

Accepted Solutions
Forteen Stars TRF
Forteen Stars

Re: tSendMail to multiple recipients get from table

You want to send 1 email to a list of persons issued from your DB, right?

So you just have to build the lsit in your tJavaRow using a global variable:

globalMap.put("emailList", ((String)globalMap.getOrDefault("emailList", "")) + "," + input_row.email);

Then in your tSendMail you just have to get the content of the list but the 1rst character to populate the "To" field:

((String)globalMap.get("emailList")).substring(1)

In case of, it could be a good idea to add a tJava (don't change anything inside) before tSendMail, both connected by an "If" trigger with the following condition:

((String)globalMap.get("emailList")) != null

This is to avoid to call tSendMail when the list is empty.


TRF

All Replies
Forteen Stars TRF
Forteen Stars

Re: tSendMail to multiple recipients get from table

You want to send 1 email to a list of persons issued from your DB, right?

So you just have to build the lsit in your tJavaRow using a global variable:

globalMap.put("emailList", ((String)globalMap.getOrDefault("emailList", "")) + "," + input_row.email);

Then in your tSendMail you just have to get the content of the list but the 1rst character to populate the "To" field:

((String)globalMap.get("emailList")).substring(1)

In case of, it could be a good idea to add a tJava (don't change anything inside) before tSendMail, both connected by an "If" trigger with the following condition:

((String)globalMap.get("emailList")) != null

This is to avoid to call tSendMail when the list is empty.


TRF
Five Stars

Re: tSendMail to multiple recipients get from table

Thank You, it worked fine.