MessageGatewayService | Community
Skip to main content
New Participant
October 16, 2015
Solved

MessageGatewayService

  • October 16, 2015
  • 6 replies
  • 4021 views

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?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by kautuk_sahni

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

6 replies

dan_klco
New Participant
February 22, 2018

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/

kautuk_sahni
kautuk_sahniAccepted solution
Employee
October 19, 2015

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
Ratna_Kumar
New Participant
October 16, 2015

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.

Peter_Puzanovs
New Participant
October 16, 2015

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

New Participant
October 16, 2015

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.

Peter_Puzanovs
New Participant
October 16, 2015

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