Hi @keerthana_h_n
You will have to first configure SMTP details in the Day CQ Mail Service osgi configuration. Here is an article that might help you to configure this.
Then you can use com.day.cq.mailer.MessageGateway interface in your custom process step to trigger an email. Alternatively you can use Email api from ACS commons to achieve this. Here is a link to acs commons email api.
Edit:
You can read workflow initiator from workflow instance. Below is the piece of code to read workflow initiator and send her the email.
String initiator = workItem.getWorkflow().getInitiator();
Authorizable authorizable = userManager.getAuthorizable(initiator);
String userEmail = PropertiesUtil.toString(authorizable.getProperty("profile/email"), "");
if(StringUtils.isBlank(userEmail)) {
return;
}
HtmlEmail email = new HtmlEmail();
email.setCharset(CharEncoding.UTF_8);
email.addTo(userEmail);
email.setSubject("test email subject");
email.setMsg("text email body");
email.setHtmlMsg("<html><head></head><body><p>html email body</p></body></html>");
messageGateway.send(email);
Thanks