This conversation has been locked due to inactivity. Please create a new post.
This conversation has been locked due to inactivity. Please create a new post.
I have to create custom mail service using default mail service for sending different emails. I have to read the two parameters from sling servlet i.e. targetUrl and templatePath which will be used in custom mail service for appending each outgoing email. anyone has idea ?
Solved! Go to Solution.
Views
Replies
Total Likes
I am not sure what the issue is here. Read the two values from the servlet. Then use the MessageGateway service to send an email:
//Declare a MessageGateway service
MessageGateway<Email> messageGateway;
//Set up the Email message
Email email = new SimpleEmail();
//Set the mail values
String emailToRecipients = "scottm@adobe.com";
String emailCcRecipients = "ratna1.kumar@gmail.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 AEM 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);
Views
Replies
Total Likes
This one might help : aemformssurveys/Mailer.java at master · wasilzafar/aemformssurveys · GitHub
Tnx,
Wasil
Views
Replies
Total Likes
I am not sure what the issue is here. Read the two values from the servlet. Then use the MessageGateway service to send an email:
//Declare a MessageGateway service
MessageGateway<Email> messageGateway;
//Set up the Email message
Email email = new SimpleEmail();
//Set the mail values
String emailToRecipients = "scottm@adobe.com";
String emailCcRecipients = "ratna1.kumar@gmail.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 AEM 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);
Views
Replies
Total Likes