4 weeks ago
Good afternoon!
Currently I am working on sending emails to multiple recipients using an XML payload defined as follows:
<EmpRecords>
<EmpRecord>
<EmpId>123</EmpId>
<EmpFName>Gopi</EmpFName>
<EmpLName>K</EmpLName>
<EmpCountry>IN</EmpCountry>
<EmpSalary>30000 </EmpSalary>
<email>test1@mail.com</email>
</EmpRecord>
<EmpRecord>
<EmpId>456</EmpId>
<EmpFName>Ram</EmpFName>
<EmpLName>C</EmpLName>
<EmpCountry>IN</EmpCountry>
<EmpSalary>30000</EmpSalary>
<email> test2@mail.com </email>
</EmpRecord>
<EmpRecord>
<EmpId>789</EmpId>
<EmpFName>Mohammad</EmpFName>
<EmpLName>Khan</EmpLName>
<EmpCountry>IN</EmpCountry>
<EmpSalary>40000</EmpSalary>
<email> test3@mail.com </email>
</EmpRecord>
<EmpRecord>
<EmpId>234</EmpId>
<EmpFName>Varnikai</EmpFName>
<EmpLName>L</EmpLName>
<EmpCountry>IN</EmpCountry>
<EmpSalary>40000</EmpSalary>
<email> test4@mail.com </email>
</EmpRecord>
</EmpRecords>
The test emails are:
test1@mail.com
test2@mail.com
test3@mail.com
test4@mail.com
However, I have not found a way to put the 4 emails coming from the payload into the email connector definition.
Is there a method to dynamically place emails that come from an XML Payload?
Thanks
Regards
Hello Mario,
To configure multiple email receivers we must pass all the email addresses separated by a comma (,) to the "To" field of the receiver mail adapter.
Reference - Configure the mail receiver adapter
Now assuming you have to send the same email content to all the possible email IDs that are present in the source XML payload, we would need to dynamically extract the email IDs, have them comma (,) separated and pass the value to the receiver Email Adapter's "To" field.
Step 1 - Extract all possible receiver email addresses separated by comma (,) into a property.
To achieve this you can use a content modifier and extract the IDs using an xpath expression into a property - -
Property Name = receiverEmailID
Source Type = XPath
Source Value = string-join(//email/normalize-space(), ',')
For your XML payload, above step would update the property receiverEmailID with value - test1@mail.com,test2@mail.com,test3@mail.com,test4@mail.com
Step 2 - Configure the property value ${property.receiverEmailID} in the "To" field under processing for mail receiver adapter.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
4 | |
3 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.