I am facing an issue where I am using AEM messageGateway service to send the email. In case where emails are not triggered successfully, I am not getting any error message and it always ends with success message. Is there a way to check if the email was sent successfully or not ? Any help would be highly appreciated.
Below is the example of code:
try {
final MessageGateway<Email> messageGateway = messageGatewayService.getGateway(Email.class);
//all details of the mail in between to be added to email object
messageGateway.send(email);
} catch (Exception e) {
LOGGER.error("Error occurred in sendEmail {}", e);
}