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

About Custom Email Step and Day CQ Mail Service

Avatar

Avatar
Ignite 1
Level 2
k_ra
Level 2

Likes

4 likes

Total Posts

25 posts

Correct Reply

1 solution
Top badges earned
Ignite 1
Give Back 5
Give Back 3
Give Back 10
Give Back
View profile

Avatar
Ignite 1
Level 2
k_ra
Level 2

Likes

4 likes

Total Posts

25 posts

Correct Reply

1 solution
Top badges earned
Ignite 1
Give Back 5
Give Back 3
Give Back 10
Give Back
View profile
k_ra
Level 2

04-04-2019

I have written a custom email step in which I am using "email.setFrom(emailId)" to set the from email address for it but I see that it's not sending the mail from the from address I set using that snippet. It's actually picking up the smtp user from the Day CQ Mail Service and sending it from his email address. I am confused about it. Is it working as expected? Can anyone explain and confirm it?

Thanks

Replies

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,358 likes

Total Posts

3,228 posts

Correct Reply

918 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,358 likes

Total Posts

3,228 posts

Correct Reply

918 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

04-04-2019

No, It should send mail from the email address which you are setting in code e.g. email.setFrom("abc.xyz@forum.com")

Please check below

Adobe Experience Manager Help | Creating custom AEM workflow steps that send email messages

Avatar

Avatar
Ignite 1
Level 2
k_ra
Level 2

Likes

4 likes

Total Posts

25 posts

Correct Reply

1 solution
Top badges earned
Ignite 1
Give Back 5
Give Back 3
Give Back 10
Give Back
View profile

Avatar
Ignite 1
Level 2
k_ra
Level 2

Likes

4 likes

Total Posts

25 posts

Correct Reply

1 solution
Top badges earned
Ignite 1
Give Back 5
Give Back 3
Give Back 10
Give Back
View profile
k_ra
Level 2

04-04-2019

Tried it many times still, its sends from SMTP user's mail address only. email.setFrom() doesn't work. The snippet I am using is below,

Email email = new SimpleEmail();

MessageGateway<Email> messageGateway = messageGatewayService.getGateway(Email.class);

email.setSubject(subject);

email.addTo(emailId);

email.setContent(emailMessage, "text/html; charset=utf-8");

email.setFrom("xyz@gmail.com");

messageGateway.send((Email) email);

Avatar

Avatar
Ignite 1
Level 2
k_ra
Level 2

Likes

4 likes

Total Posts

25 posts

Correct Reply

1 solution
Top badges earned
Ignite 1
Give Back 5
Give Back 3
Give Back 10
Give Back
View profile

Avatar
Ignite 1
Level 2
k_ra
Level 2

Likes

4 likes

Total Posts

25 posts

Correct Reply

1 solution
Top badges earned
Ignite 1
Give Back 5
Give Back 3
Give Back 10
Give Back
View profile
k_ra
Level 2

04-04-2019

"email.setFrom("xyz@gmail.com","kira")"

If I use this method it will still trigger the mail from SMTP user mail address and use the name "kira" which I entered here in this snippet. (i.e from address in the mail will be "kira <STMP mail address instead of the mail address I provide in the snippet>")

Avatar

Avatar
Validate 1
Level 1
AshokPelluru
Level 1

Likes

0 likes

Total Posts

7 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
AshokPelluru
Level 1

Likes

0 likes

Total Posts

7 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
AshokPelluru
Level 1

04-04-2019

Just for confirmation, I hope you are using org.apache.commons.mail.HtmlEmail or org.apache.commons.mail.SimpleEmail.

we were using since years which is working fine.

final Class<? extends Email> mailType = templatePath.endsWith(".html") ? HtmlEmail.class : SimpleEmail.class;

final Email email = mailTemplate.getEmail(StrLookup.mapLookup(params), mailType);

email.setFrom(params.get("senderEmailAddress"));

email.setTo(recipients);

final MessageGateway<Email> messageGateway = messageGatewayService.getGateway(mailType);

messageGateway.send(email);

Avatar

Avatar
Validate 1
Level 2
ruchim
Level 2

Likes

4 likes

Total Posts

13 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 3
Affirm 1
View profile

Avatar
Validate 1
Level 2
ruchim
Level 2

Likes

4 likes

Total Posts

13 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 3
Affirm 1
View profile
ruchim
Level 2

25-05-2019

We are facing the same issue. Were you able to find a fix for this?

Avatar

Avatar
Ignite 1
Level 2
k_ra
Level 2

Likes

4 likes

Total Posts

25 posts

Correct Reply

1 solution
Top badges earned
Ignite 1
Give Back 5
Give Back 3
Give Back 10
Give Back
View profile

Avatar
Ignite 1
Level 2
k_ra
Level 2

Likes

4 likes

Total Posts

25 posts

Correct Reply

1 solution
Top badges earned
Ignite 1
Give Back 5
Give Back 3
Give Back 10
Give Back
View profile
k_ra
Level 2

27-05-2019

no

Avatar

Avatar
Validate 1
Level 2
ruchim
Level 2

Likes

4 likes

Total Posts

13 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 3
Affirm 1
View profile

Avatar
Validate 1
Level 2
ruchim
Level 2

Likes

4 likes

Total Posts

13 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 3
Affirm 1
View profile
ruchim
Level 2

27-05-2019

This seems to be an issue if we use google SMTP. I tried with the settings of a fake smtp server and it worked fine.

Avatar

Avatar
Ignite 1
Level 2
k_ra
Level 2

Likes

4 likes

Total Posts

25 posts

Correct Reply

1 solution
Top badges earned
Ignite 1
Give Back 5
Give Back 3
Give Back 10
Give Back
View profile

Avatar
Ignite 1
Level 2
k_ra
Level 2

Likes

4 likes

Total Posts

25 posts

Correct Reply

1 solution
Top badges earned
Ignite 1
Give Back 5
Give Back 3
Give Back 10
Give Back
View profile
k_ra
Level 2

27-05-2019

good to know, Thanks.