Hi Friends,
I am trying to send email in participant step. I have written a email service which uses the Message Gateway to send emails.
But MessageGateway<Email> messageGateway = this.messageGatewayService.getGateway(Email.class); this line is giving messageGateway as null.
I went through a number of posts and everywhere it is mentioned that if the SMTP details are not mentioned properly in Day Cq Mail service then it comes as null.
But I have configured it properly because if I select the senEmail checkbox in the dynamic step then AEM is able to send default emails using this. So I am sure SMTP is not something which can be at fault. Do we need something else also so that the messageGateway doesnot come as null. I am using AEM 6.1 SP3.
Thanks,
Tushar
Solved! Go to Solution.
Views
Replies
Total Likes
Here is video so you can watch all the steps.
https://www.youtube.com/watch?v=9Ztc9hBbrwg&feature=youtu.be
Also - try on a fresh install of AEM. There may be some missing services or other mis-configured services.
Views
Replies
Total Likes
Hi Tushar,
Please check this article which discusses sending email messages using MessageGateway service:
//https://helpx.adobe.com/experience-manager/using/creating-custom-aem-workflow-steps.html
Also, add this dependency in your POM(According to the article)
<dependency>
<groupId>com.day.cq</groupId>
<artifactId>cq-mailer</artifactId>
<version>5.6.2</version>
<scope>provided</scope>
</dependency>
It worked for me many times and you need to configure Email properly in configuration manager.
In order to configure properly, you need to check this excellent article which tells how to configure the email:: http://versatileankur.blogspot.in/2016/04/mailing-issue-in-aem-with-gmail-smtp.html
Hope this helps!!
~ Ratna.
Views
Replies
Total Likes
I have added that dependency already, also as I have mentioned earlier if I use aem's send email functionality in the participant step the default email does get generated which ascertains the fact that my SMTP details are working fine.
The only issue I am facing is the Message Gateway coming as null. I wanted to know is this a bug with AEM 6.1 sp2 that we cannot send email through our customized way i.e. using MessageGateway.
Thanks for any help.
Views
Replies
Total Likes
Hi Scott,
I have tried even that and still the MessageGateway comes null. I know the smtp config is correct as the default emails from Aem are generating fine.
Views
Replies
Total Likes
What do you see at the component in /system/console?
There you can see the reason why a reference can't be found
Views
Replies
Total Likes
How can I check in /system/console why messageGatewayService.getGateway(HtmlEmail.class) gives me null??
Views
Replies
Total Likes
Via /system/console/components, search your component. Then you can see why references are not found
Views
Replies
Total Likes
Hi,
I am seeing something like below
Reference messageGatewayService | ["Unsatisfied","Service Name: com.day.cq.mailer.MessageGatewayService","Cardinality: 1..1","Policy: static","Policy Option: reluctant","No Services bound"] |
Could you please let me know why this could be coming like this.
Thanks,
Tushar
Views
Replies
Total Likes
Now check via services (/system/console/services), find the component-id and check on the component on status.
Views
Replies
Total Likes
Here is video so you can watch all the steps.
https://www.youtube.com/watch?v=9Ztc9hBbrwg&feature=youtu.be
Also - try on a fresh install of AEM. There may be some missing services or other mis-configured services.
Views
Replies
Total Likes
Restarting the com.day.cq.cq-mailer bundle in the environment was the solution that worked for me.
The MessageGatewayService contains a hashSet of gateways. If you delete or move your Day CQ Mail Service configuration, a new gateway is added to the hashSet. The messageGatewayService.getGateway() only retrieves one DefaultMailService from the hashSet, and it could be one with cfg null inside, although there exists one configured correctly. Only way to clean this up is by restarting the bundle.
Any subsequent updates to theDefaultMailService config work fine. This only happens when you delete/move your config in your environment.
Views
Replies
Total Likes
Views
Likes
Replies