Examples of MailerResult


Examples of org.olat.core.util.mail.MailerResult

              public void putVariablesInMailContext(VelocityContext context, Identity recipient) {
                // nothing to do
              }
            };
             
            MailerResult result = MailerWithTemplate.getInstance().sendMail(ureq.getIdentity(), null, null, mailTempl, null);
            if(result.getFailedIdentites().size() > 0) {
              List<Identity> disabledIdentities = new ArrayList<Identity>();
              disabledIdentities = result.getFailedIdentites();
              //show error that message can not be sent
              ArrayList<String> myButtons = new ArrayList<String>();
              myButtons.add(translate("back"));
              String title = MailHelper.getTitleForFailedUsersError(ureq.getLocale());
              String message = MailHelper.getMessageForFailedUsersError(ureq.getLocale(), disabledIdentities);
              // add dropbox specific error message
              message += "\n<br />"+translate("conf.mail.error");
              //FIXME:FG:6.2: fix problem in info message, not here
              message += "\n<br />\n<br />"+confirmation.replace("\n", "&#10;").replace("\r", "&#10;").replace("\u2028", "&#10;");
              DialogBoxController noUsersErrorCtr = null;
              noUsersErrorCtr = activateGenericDialog(ureq, title, message, myButtons, noUsersErrorCtr);
              sendMailError = true;
            } else if(result.getReturnCode() > 0) {
              //show error that message can not be sent
              ArrayList<String> myButtons = new ArrayList<String>();
              myButtons.add(translate("back"));
              DialogBoxController noUsersErrorCtr = null;
              String message = translate("conf.mail.error");
View Full Code Here

Examples of org.olat.core.util.mail.MailerResult

        if(addedNotificationCtr.getMailTemplate().getCpfrom()) {
          ccIdentities.add(ureq.getIdentity());
        } else {
          ccIdentities = null;
        }
        MailerResult mailerResult = MailerWithTemplate.getInstance().sendMailAsSeparateMails(added, null, null, addedNotificationCtr.getMailTemplate(), ureq.getIdentity());
        MailHelper.printErrorsAndWarnings(mailerResult, getWindowControl(), ureq.getLocale());
      }
      notificationCmc.deactivate();
      addedNotificationCtr = null;
      notificationCmc = null;
      added.clear();
    } else if(source == removedNotificationCtr && event == Event.DONE_EVENT) {
      if(removedNotificationCtr.getMailTemplate() != null) {
          List<Identity> ccIdentities = new ArrayList<Identity>();
        if(addedNotificationCtr.getMailTemplate().getCpfrom()) {
          ccIdentities.add(ureq.getIdentity());
        } else {
          ccIdentities = null;
        }
        MailerResult mailerResult = MailerWithTemplate.getInstance().sendMailAsSeparateMails(added, null, null, addedNotificationCtr.getMailTemplate(), ureq.getIdentity());
        MailHelper.printErrorsAndWarnings(mailerResult, getWindowControl(), ureq.getLocale());
      }
      notificationCmc.deactivate();
      removedNotificationCtr = null;
      notificationCmc = null;
View Full Code Here

Examples of org.olat.core.util.mail.MailerResult

      public void putVariablesInMailContext(VelocityContext context, Identity recipient) {
      // nothing to do
      }
    };

    MailerResult result = MailerWithTemplate.getInstance().sendMail(to, null, null, mailTempl, null);
    if (result.getReturnCode() > 0) {
      log.warn("Could not send email to identity " + to.getName() + ". (returncode="+result.getReturnCode()+", to="+to+")");
      return false;
    }
    return true;
  }
View Full Code Here

Examples of org.olat.core.util.mail.MailerResult

      to = new Address[] { new InternetAddress(notificationMailAddress)};
    } catch (AddressException e) {
      Tracing.logError("Could not send registration notification message, bad mail address", e, RegistrationManager.class);
      return;
    }
    MailerResult result = new MailerResult();
    User user = newIdentity.getUser();
    Locale loc = I18nModule.getDefaultLocale();
    String[] userParams = new  String[] {newIdentity.getName(), user.getProperty(UserConstants.FIRSTNAME, loc), user.getProperty(UserConstants.LASTNAME, loc), user.getProperty(UserConstants.EMAIL, loc),
        user.getPreferences().getLanguage(), Settings.getServerconfig("server_fqdn") + WebappHelper.getServletContextPath() };
    Translator trans = new PackageTranslator(Util.getPackageName(RegistrationManager.class), loc);
    String subject = trans.translate("reg.notiEmail.subject", userParams);
    String body = trans.translate("reg.notiEmail.body", userParams);
   
    MailHelper.sendMessage(from, to , null, null, body, subject, null, result);
    if (result.getReturnCode() != MailerResult.OK ) {
      Tracing.logError("Could not send registration notification message, MailerResult was ::" + result.getReturnCode(), RegistrationManager.class);     
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.