Skip to main content
Announcements
A fresh, new look for the Data Integration & Quality forums and navigation! Read more about what's changed.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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.

0683p000009LxNT.jpg

 

 

 

Labels (3)
1 Solution

Accepted Solutions
TRF
Champion II

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.

View solution in original post

2 Replies
TRF
Champion II

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.

Anonymous
Not applicable
Author

Thank You, it worked fine.