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;
Email email = new SimpleEmail();
email.addTo(emailToRecipients);
email.addCc(emailCcRecipients);
email.setSubject("AEM Custom Step");
email.setMsg("This message is to inform you that the CQ content has been deleted");
messageGateway = messageGatewayService.getGateway(Email.class);
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