Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

MessageGatewayService

Avatar

Level 4

Hi,

I'm using cq5.5 and i have some problems about the MessageGatewayService.

import com.day.cq.mailer.MessageGatewayService;

@Reference
    private MessageGatewayService messageGatewayService;  

I'm not able to access this reference and the import doesn't exist.

Is the class changed? Did i leave something?

1 Accepted Solution

Avatar

Correct answer by
Administrator

Hi

Please refer to the article mentioned below for more information (these article will give you step by step to setup message gateways with different use-cases ) :-

Link 1:- https://helpx.adobe.com/experience-manager/using/creating-custom-aem-workflow-steps.html

//

 MessageGateway<Email> messageGateway;
          
    //Set up the Email message
    Email email = new SimpleEmail();
          
    //Set the mail values
    String emailToRecipients = "tblue@nomailserver.com";
    String emailCcRecipients = "wblue@nomailserver.com";
      
    email.addTo(emailToRecipients);
    email.addCc(emailCcRecipients);
    email.setSubject("AEM Custom Step");
    email.setFrom("scottm@adobe.com");
    email.setMsg("This message is to inform you that the CQ content has been deleted");
      
    //Inject a MessageGateway Service and send the message
    messageGateway = messageGatewayService.getGateway(Email.class);
  
    // Check the logs to see that messageGateway is not null
    messageGateway.send((Email) email);

 

Link 2:- http://labs.6dglobal.com/blog/2012-08-20/sending-email-adobe-cq-api/

Link 3 :- https://helpx.adobe.com/aem-forms/6/aem-workflows-submit-process-form.html

 

I hope this would help you.

 

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

View solution in original post

6 Replies

Avatar

Community Advisor

Make sure you have "Day CQ Mail Service"(/system/console/configMgr/com.day.cq.mailer.DefaultMailService) is configured correctly. When it's not, there is no Osgi service MessageGatewayService Thanks, Peter

Avatar

Level 4

It is configured but i have an error by the correction tool of eclipse. I don't think there is a problem about the configuration of this service.

Avatar

Community Advisor

Not sure why are you referring to your eclipse IDE..

The link posted earlier(/system/console/configMgr/com.day.cq.mailer.DefaultMailService) would open the actual OSGi service for you wit atual settings. This service has cancel, reset, delete, unbind and save buttons. Try to check values, then click unbind, then save.

Thanks,

Peter

Avatar

Level 10

Hi Samuel,

Please look into this workflow article that indicates Message Gateway Service. I did so many times, it works. Also make sure you import both these

import com.day.cq.mailer.MessageGateway;
import com.day.cq.mailer.MessageGatewayService;

https://helpx.adobe.com/experience-manager/using/creating-custom-aem-workflow-steps.html

Thanks,
Ratna Kumar.

Avatar

Correct answer by
Administrator

Hi

Please refer to the article mentioned below for more information (these article will give you step by step to setup message gateways with different use-cases ) :-

Link 1:- https://helpx.adobe.com/experience-manager/using/creating-custom-aem-workflow-steps.html

//

 MessageGateway<Email> messageGateway;
          
    //Set up the Email message
    Email email = new SimpleEmail();
          
    //Set the mail values
    String emailToRecipients = "tblue@nomailserver.com";
    String emailCcRecipients = "wblue@nomailserver.com";
      
    email.addTo(emailToRecipients);
    email.addCc(emailCcRecipients);
    email.setSubject("AEM Custom Step");
    email.setFrom("scottm@adobe.com");
    email.setMsg("This message is to inform you that the CQ content has been deleted");
      
    //Inject a MessageGateway Service and send the message
    messageGateway = messageGatewayService.getGateway(Email.class);
  
    // Check the logs to see that messageGateway is not null
    messageGateway.send((Email) email);

 

Link 2:- http://labs.6dglobal.com/blog/2012-08-20/sending-email-adobe-cq-api/

Link 3 :- https://helpx.adobe.com/aem-forms/6/aem-workflows-submit-process-form.html

 

I hope this would help you.

 

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

Avatar

Level 5

FYI - Since labs.6dglobal.com is down, here's the same article on Sending Email via the CQ API on my personal blog: https://www.danklco.com/posts/2012/08/20/sending-email-adobe-cq-api/