protected Multipart createContent(Map<String, Object> context, SavedSearchType type) {
   try {
     if (type.equals(SavedSearchType.JOURNAL_ALERT)) {
       return mailer.createContent(this.alertTextEmail, this.alertHtmlEmail, context);
     } else {
       return mailer.createContent(this.savedSearchTextEmail, this.savedSearchHtmlEmail, context);
     }
   } catch (IOException ex) {
     throw new RuntimeException(ex);
   } catch (MessagingException ex) {
     throw new RuntimeException(ex);
   }
 }
  protected void mail(
      String toAddress,
      String fromAddress,
      String subject,
      Map<String, Object> context,
      Multipart content) {

    // If sendMode empty, do nothing
    if (sendMode != null) {
      if (sendMode.toUpperCase().equals(PRODUCTION_MODE)) {
        mailer.mail(toAddress, fromAddress, subject, context, content);
        log.debug("Mail sent, mode: {}, address: {}", new Object[] {PRODUCTION_MODE, toAddress});
      }

      if (sendMode.toUpperCase().equals(QA_MODE)) {
        mailer.mail(
            sendModeQAEMail, fromAddress, "(" + toAddress + ")" + subject, context, content);
        log.debug("Mail sent, mode: {}, address: {}", new Object[] {QA_MODE, sendModeQAEMail});
      }

      // If sendMode does not match "production" or "QA", do nothing
    }
  }