Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

AEM 6.4 - How to have multiple To recipients in email template.

Avatar

Avatar
Give Back
Level 1
mohammed_muneeb
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Give Back
Ignite 1
View profile

Avatar
Give Back
Level 1
mohammed_muneeb
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Give Back
Ignite 1
View profile
mohammed_muneeb
Level 1

19-06-2018

How to have multiple To recipients in my Email ?

Currently String[] sends mail one by one.

But i want the email to be sent having multiple people in To .

How can i achieve it ? I tried ACS commons API with these options. nothing worked. Got Invalid Recipients error.  I referred this documentation.

Email API

String recipients = "email@ab.com,email2@ab.com";

emailService.sendEmail(htmlEmailTemplatePath, emailParams, attachments, recipients)

String recipients = "email@ab.com;email2@ab.com";

emailService.sendEmail(htmlEmailTemplatePath, emailParams, attachments, recipients)

String recipients = "To : email@ab.com"+"\n"+"To : email2@ab.com";

emailService.sendEmail(htmlEmailTemplatePath, emailParams, attachments, recipients)

I tried various options like declaring recipients in above format but nothing worked. I want something like this in my email.

To : email@ab.com, email2@ab.com Sub : Sample Subj Email Body....

Replies

Avatar

Avatar
Boost 1
Level 1
AEMDoc
Level 1

Likes

2 likes

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
AEMDoc
Level 1

Likes

2 likes

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile
AEMDoc
Level 1

19-06-2018

Hello Mohammad,

In the API you have referenced the 'recepients' argument is a variable array of recipients email addresses. Therefore, you would need to define it in the following format:

String[] recipients = { "recipient1@example.com", "recipient2@example.com" };

Hope this helps!

Avatar

Avatar
Give Back
Level 1
mohammed_muneeb
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Give Back
Ignite 1
View profile

Avatar
Give Back
Level 1
mohammed_muneeb
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Give Back
Ignite 1
View profile
mohammed_muneeb
Level 1

20-06-2018

Hi,

Thanks for the response. By declaring String[] recipients = { "recipient1@example.com", "recipient2@example.com" };

two emails will get generated right ?

First Email will have recipient1@example.com in To field and Second Email will have recipient2@example.com in To field. How can i generate single email having both recipient 1 and recipient 2 in To field ?

Avatar

Avatar
Boost 1
Level 1
AEMDoc
Level 1

Likes

2 likes

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
AEMDoc
Level 1

Likes

2 likes

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile
AEMDoc
Level 1

20-06-2018

I am not sure if that can be done with the ACS commons bundle but what you can do (more of a workaround) is to have the recipient list in the body of the template to let each recipient know about who else the email was sent to (assuming that's the use case).

You can also leverage the ACS commons chat support from the below link and bring this up as a potential enhancement with them:

acsaemhttps://gitter.im/Adobe-Consulting-Services/acs-aem-commons

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,406 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,406 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

20-06-2018

Write a custom AEM Service that uses Java MAIL API.