Package org.olat.core.util.mail

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


      }});
   

    // 3. Send notification mail
    MailTemplate mailTemplate = BGMailHelper.createRemoveWaitinglistMailTemplate(enrolledWaitingListGroup, identity);
    MailerWithTemplate mailer = MailerWithTemplate.getInstance();
    MailerResult mailerResult = mailer.sendMail(identity, null, null, mailTemplate, null);
    MailHelper.printErrorsAndWarnings(mailerResult, wControl, trans.getLocale());
  }
View Full Code Here


      thisTime.setStringValue(nowString);
      coursePropertyManager.updateProperty(thisTime);
    }
    // 4. Send notification mail
    MailTemplate mailTemplate = BGMailHelper.createAddMyselfMailTemplate(group, identity);
    MailerWithTemplate mailer = MailerWithTemplate.getInstance();
    MailerResult mailerResult = mailer.sendMail(identity, null, null, mailTemplate, null);
    MailHelper.printErrorsAndWarnings(mailerResult, wControl, trans.getLocale());


    return true;
  }
View Full Code Here

      thisTime.setStringValue(nowString);
      coursePropertyManager.updateProperty(thisTime);
    }   
    // 4. Send notification mail
    MailTemplate mailTemplate = BGMailHelper.createAddWaitinglistMailTemplate(group, identity);
    MailerWithTemplate mailer = MailerWithTemplate.getInstance();
    MailerResult mailerResult = mailer.sendMail(identity, null, null, mailTemplate, null);
    MailHelper.printErrorsAndWarnings(mailerResult, wControl, trans.getLocale());

    return true;
  }
View Full Code Here

  }


  private String sendEmailToIdentity(Identity identity,HashMap identityRepositoryList, MailTemplate template,
      boolean isTemplateChanged, String keyEmailSubject, String keyEmailBody, Identity sender, Translator pT) {
    MailerWithTemplate mailer = MailerWithTemplate.getInstance();
    template.addToContext("responseTo", emailResponseTo);
    if (!isTemplateChanged) {
      // Email template has NOT changed => take translated version of subject and body text
    Translator identityTranslator = new PackageTranslator(PACKAGE, I18nManager.getInstance().getLocaleOrDefault(identity.getUser().getPreferences().getLanguage()));
      template.setSubjectTemplate(identityTranslator.translate(keyEmailSubject));
      template.setBodyTemplate(identityTranslator.translate(keyEmailBody));
    }
    // loop over all repositoriesOfIdentity to build email message
    StringBuilder buf = new StringBuilder();
    for (Iterator repoIterator = ((List)identityRepositoryList.get(identity)).iterator(); repoIterator.hasNext();) {
      RepositoryEntry repositoryEntry = (RepositoryEntry) repoIterator.next();
      buf.append("\n  ").append( repositoryEntry.getDisplayname() ).append(" / ").append(trimDescription(repositoryEntry.getDescription(), 60));
    }
    template.addToContext("repositoryList", buf.toString());
    template.putVariablesInMailContext(template.getContext(), identity);
    Tracing.logDebug(" Try to send Delete-email to identity=" + identity.getName() + " with email=" + identity.getUser().getProperty(UserConstants.EMAIL, null), this.getClass());
    List<Identity> ccIdentities = new ArrayList<Identity>();
    if(template.getCpfrom()) {
      ccIdentities.add(sender);
    } else {
      ccIdentities = null
    }
    MailerResult mailerResult = mailer.sendMailUsingTemplateContext(identity, ccIdentities, null, template, sender);
    if (mailerResult.getReturnCode() == MailerResult.OK) {
      // Email sended ok => set deleteEmailDate
      for (Iterator repoIterator = ((List)identityRepositoryList.get(identity)).iterator(); repoIterator.hasNext();) {
        RepositoryEntry repositoryEntry = (RepositoryEntry) repoIterator.next();
        Tracing.logAudit("Repository-Deletion: Delete-email for repositoryEntry=" + repositoryEntry + "send to identity=" + identity.getName(), this.getClass());
View Full Code Here

TOP

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

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.