Example #1
0
 public static List<String> sendEmailToAdmins(
     String subject, String contentHTML, List<String> tags, Exception ex) {
   try {
     String body = contentHTML + " <br/><br/>  Exception: " + ex;
     for (StackTraceElement stackTraceElement : ex.getStackTrace()) {
       body = body + " <br/>             " + stackTraceElement;
     }
     return EmailsUtils.sendEmailToAdmins(subject, body, tags);
   } catch (Exception e) {
     logger.error("Error sending email to Admin for Errors:'" + "' Error: " + e);
     return null;
   }
 }
Example #2
0
 public static List<String> sendEmailToAdmins(
     String subject, String contentHTML, List<String> tags) throws RemoteServiceException {
   List<String> status = new ArrayList<>();
   for (String mailAdmin : MiddlewareProperties.NOTIFICATIONS_EMAIL_RECIPIENTS) {
     String mailResponse = null;
     try {
       mailResponse =
           EmailsUtils.sendEmail(
               "*****@*****.**",
               "WitBookingAPI",
               subject,
               contentHTML,
               mailAdmin,
               "WitBooker Admin",
               tags);
     } catch (RemoteServiceException e) {
       try {
         sendEmailByJava(
             subject,
             contentHTML
                 + "<br/><br/><b>ALERT!<b/> ERROR SENDING THIS EMAIL FROM MANDRILL. SENT FROM JAVA MAIL!<br/>",
             Arrays.asList(mailAdmin));
       } catch (MailingException ex) {
         logger.error(
             "Error Sending Emails from Java to WitBookerAdmin: email:'"
                 + mailAdmin
                 + "' Error: "
                 + ex);
       }
     }
     if (!mailResponse.equalsIgnoreCase(EmailsUtils.STATUS_EMAIL_CONFIRMED)) {
       logger.error("Error in the Mailing sender to WitBooker Admin: email:'" + mailAdmin + "' ");
       try {
         sendEmailByJava(
             subject,
             contentHTML
                 + "<br/><br/><b>ALERT!<b/> ERROR SENDING THIS EMAIL FROM MANDRILL. SENT FROM JAVA MAIL!<br/>",
             Arrays.asList(mailAdmin));
       } catch (MailingException e) {
         logger.error(
             "Error Sending Emails from Java to WitBookerAdmin: email:'"
                 + mailAdmin
                 + "' Error: "
                 + e);
       }
     }
     status.add(mailResponse);
   }
   return status;
 }