Package org.olat.core.util.mail

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


                                    projectBrokerModuleConfiguration.isAutoSignOut(), projectBrokerModuleConfiguration.isAcceptSelectionManually());
        identitiesMoveEvent.setMovedIdentities(identitiesMoveEvent.getChosenIdentities());
        identitiesMoveEvent.setNotMovedIdentities(new ArrayList());
        // send mail for all of them
        MailerWithTemplate mailer = MailerWithTemplate.getInstance();
        MailTemplate mailTemplate = identitiesMoveEvent.getMailTemplate();
        if (mailTemplate != null) {
          List<Identity> ccIdentities = new ArrayList<Identity>();
          if(mailTemplate.getCpfrom()) {
            // add sender as CC
            ccIdentities.add(urequest.getIdentity());
          } else {
            ccIdentities = null
          }
View Full Code Here


  }
 
  @Override
  protected void event(UserRequest ureq, Controller source, Event event) {
    if(source == mailCtr && event == Event.DONE_EVENT) {
      MailTemplate mailTemplate = mailCtr.getMailTemplate();
      if(mailTemplate != null) {
        List<Identity> recipientsCC = null;
        if(mailTemplate.getCpfrom()) {
          recipientsCC = new ArrayList<Identity>();
          recipientsCC.add(ureq.getIdentity());
        }
        MailerWithTemplate.getInstance().sendMailAsSeparateMails(learners, recipientsCC, null, mailCtr.getMailTemplate(), ureq.getIdentity());
      }
View Full Code Here

        };
   
    String subject = translator.translate("inform.users.subject", bodyArgs);
    String body = translator.translate("inform.users.body", bodyArgs);
   
    MailTemplate mailTempl = new MailTemplate(subject, body, null) {
      @Override
      @SuppressWarnings({"unused"})
      public void putVariablesInMailContext(VelocityContext context, Identity identity) {
        // nothing to do
      }
View Full Code Here

  //////////////////
  // Private Methods 
  //////////////////
  private MailerResult sendEmail(Identity enrolledIdentity, Project project, String subject, String body, Locale locale) {
    MailTemplate enrolledMailTemplate = this.createMailTemplate(project, enrolledIdentity, subject, body, locale );
    // TODO: cg/12.01.2010 in der Methode sendMailUsingTemplateContext wurden die Variablen nicht ersetzt (Fehler oder falsch angewendet?)
    //       als Workaround wurde die Methode sendMailAsSeparateMails verwendet
    List<Identity> enrolledIdentityList = new ArrayList<Identity>();
    enrolledIdentityList.add(enrolledIdentity);
    MailerResult mailerResult = MailerWithTemplate.getInstance().sendMailAsSeparateMails(enrolledIdentityList, null, null, enrolledMailTemplate, null);
View Full Code Here

    log.audit("ProjectBroker: sendEmail to identity.name=" + enrolledIdentity.getName() + " , mailerResult.returnCode=" + mailerResult.getReturnCode());
    return mailerResult;
  }

  private MailerResult sendEmailToGroup(SecurityGroup group, Identity enrolledIdentity, Project project, String subject, String body, Locale locale) {
    MailTemplate enrolledMailTemplate = this.createMailTemplate(project, enrolledIdentity, subject, body, locale );
    // loop over all project manger
    List<Identity> projectManagerList = ManagerFactory.getManager().getIdentitiesOfSecurityGroup(group);
    StringBuilder identityNames = new StringBuilder();
    for (Identity identity : projectManagerList) {
      if (identityNames.length()>0) identityNames.append(",");
View Full Code Here

    log.audit("ProjectBroker: sendEmailToGroup: identities=" + identityNames.toString() + " , mailerResult.returnCode=" + mailerResult.getReturnCode());
    return mailerResult;
  }

  private MailerResult sendEmailProjectChanged(SecurityGroup group, Identity changer, Project project, String subject, String body, Locale locale) {
    MailTemplate enrolledMailTemplate = this.createProjectChangeMailTemplate(project, changer, subject, body, locale );
    // loop over all project manger
    List<Identity> projectManagerList = ManagerFactory.getManager().getIdentitiesOfSecurityGroup(group);
    StringBuilder identityNames = new StringBuilder();
    for (Identity identity : projectManagerList) {
      if (identityNames.length()>0) identityNames.append(",");
View Full Code Here

    final String currentDate  = Formatter.getInstance(locale).formatDateAndTime(new Date());
    final String firstNameEnrolledIdentity = enrolledIdentity.getUser().getProperty(UserConstants.FIRSTNAME, null);
    final String lastnameEnrolledIdentity  = enrolledIdentity.getUser().getProperty(UserConstants.LASTNAME, null);
    final String usernameEnrolledIdentity  = enrolledIdentity.getName();
     
    return new MailTemplate(subject, body, null) {
      @Override
      public void putVariablesInMailContext(VelocityContext context, Identity identity) {
        context.put("enrolled_identity_firstname", firstNameEnrolledIdentity);
        context.put("enrolled_identity_lastname",  lastnameEnrolledIdentity);
        context.put("enrolled_identity_username",  usernameEnrolledIdentity);
View Full Code Here

    final String currentDate  = Formatter.getInstance(locale).formatDateAndTime(new Date());
    final String firstnameProjectManager = changer.getUser().getProperty(UserConstants.FIRSTNAME, null);
    final String lastnameProjectManager  = changer.getUser().getProperty(UserConstants.LASTNAME, null);
    final String usernameProjectManager  = changer.getName();
     
    return new MailTemplate(subject, body, null) {
      @Override
      public void putVariablesInMailContext(VelocityContext context, Identity identity) {
        // Put variables from greater context
        context.put("projectTitle", projectTitle);
        context.put("currentDate", currentDate);
View Full Code Here

    if (redtm.getObjects(tmse.getSelection()).size() != 0) {
      selectedRepositoryEntries = redtm.getObjects(tmse.getSelection());
      if (deleteRepositoryMailCtr != null) {
        deleteRepositoryMailCtr.dispose();
      }
      MailTemplate deleteMailTemplate = createMailTemplate(pT.translate(KEY_EMAIL_SUBJECT), pT.translate(KEY_EMAIL_BODY));
      deleteMailTemplate.addToContext("lastloginduration",   Integer.toString(RepositoryDeletionManager.getInstance().getLastUsageDuration() ));
      deleteMailTemplate.addToContext("durationdeleteemail", Integer.toString(RepositoryDeletionManager.getInstance().getDeleteEmailDuration() ));
      deleteRepositoryMailCtr = new MailNotificationEditController(getWindowControl(), ureq, deleteMailTemplate, true);
      deleteRepositoryMailCtr.addControllerListener(this);
      cmc = new CloseableModalController(getWindowControl(), pT.translate("close"), deleteRepositoryMailCtr.getInitialComponent());
      cmc.activate();
    } else {
View Full Code Here

   * @param subject
   * @param body
   * @return
   */
  private MailTemplate createMailTemplate(String subject, String body) {   
    return new MailTemplate(subject, body, null) {
      @Override
      public void putVariablesInMailContext(VelocityContext context, Identity identity) {
        context.put("firstname", identity.getUser().getProperty(UserConstants.FIRSTNAME, null));
        context.put("lastname", identity.getUser().getProperty(UserConstants.LASTNAME, null));
        context.put("username", identity.getName());
View Full Code Here

TOP

Related Classes of org.olat.core.util.mail.MailTemplate

Copyright © 2018 www.massapicom. 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.