use of org.olat.core.util.mail.MailerResult in project openolat by klemens.
the class IQEditReplaceWizard method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (source == mailCtr && event == Event.DONE_EVENT) {
MailTemplate mailTemplate = mailCtr.getMailTemplate();
if (mailTemplate != null) {
MailContext context = new MailContextImpl(getWindowControl().getBusinessControl().getAsString());
String metaId = UUID.randomUUID().toString().replace("-", "");
MailerResult result = new MailerResult();
MailBundle[] bundles = mailManager.makeMailBundles(context, learners, mailTemplate, getIdentity(), metaId, result);
result.append(mailManager.sendMessage(bundles));
if (mailTemplate.getCpfrom()) {
MailBundle ccBundle = mailManager.makeMailBundle(context, getIdentity(), mailTemplate, getIdentity(), metaId, result);
result.append(mailManager.sendMessage(ccBundle));
}
}
fireEvent(ureq, Event.DONE_EVENT);
} else if (source == searchCtr && event == ReferencableEntriesSearchController.EVENT_REPOSITORY_ENTRY_SELECTED) {
selectedRepositoryEntry = searchCtr.getSelectedEntry();
doStep2(ureq);
}
}
use of org.olat.core.util.mail.MailerResult in project openolat by klemens.
the class BGEmailCompositionStepController method formOK.
@Override
protected void formOK(UserRequest ureq) {
boolean success = false;
try {
File[] attachments = contactForm.getAttachments();
MailContext context = new MailContextImpl(getWindowControl().getBusinessControl().getAsString());
MailBundle bundle = new MailBundle();
bundle.setContext(context);
bundle.setFromId(getIdentity());
bundle.setContactLists(contactForm.getEmailToContactLists());
bundle.setContent(contactForm.getSubject(), contactForm.getBody(), attachments);
MailerResult result = mailService.sendMessage(bundle);
success = result.isSuccessful();
if (contactForm.isTcpFrom()) {
MailBundle ccBundle = new MailBundle();
ccBundle.setContext(context);
ccBundle.setFromId(getIdentity());
ccBundle.setCc(getIdentity());
ccBundle.setContent(contactForm.getSubject(), contactForm.getBody(), attachments);
MailerResult ccResult = mailService.sendMessage(ccBundle);
success = ccResult.isSuccessful();
}
} catch (Exception e) {
logError(null, e);
}
if (success) {
fireEvent(ureq, StepsEvent.ACTIVATE_NEXT);
}
}
use of org.olat.core.util.mail.MailerResult in project openolat by klemens.
the class SendDocumentsByEMailController method sendEmail.
protected void sendEmail(List<Identity> tos, String subject, String body, UserRequest ureq) {
File[] attachmentArray = null;
if (attachments != null && !attachments.isEmpty() && allowAttachments) {
attachmentArray = attachments.toArray(new File[attachments.size()]);
}
MailerResult result = new MailerResult();
String metaId = UUID.randomUUID().toString().replace("-", "");
for (Identity to : tos) {
MailBundle bundle = new MailBundle();
bundle.setToId(to);
bundle.setMetaId(metaId);
bundle.setFromId(ureq.getIdentity());
bundle.setContent(subject, body, attachmentArray);
result.append(mailManager.sendMessage(bundle));
}
MailHelper.printErrorsAndWarnings(result, getWindowControl(), ureq.getUserSession().getRoles().isOLATAdmin(), ureq.getLocale());
}
use of org.olat.core.util.mail.MailerResult in project openolat by klemens.
the class MailManagerImpl method forwardToRealInbox.
@Override
public MailerResult forwardToRealInbox(Identity identity, DBMail mail, MailerResult result) {
if (result == null) {
result = new MailerResult();
}
List<DBMailAttachment> attachments = getAttachments(mail);
Address to = createAddress(identity, result, true);
MimeMessage message = createForwardMimeMessage(to, to, mail.getSubject(), mail.getBody(), attachments, result);
if (message != null) {
sendMessage(message, result);
}
return result;
}
use of org.olat.core.util.mail.MailerResult in project openolat by klemens.
the class CourseRuntimeController method doLeave.
private void doLeave(UserRequest ureq) {
if (roles.isGuestOnly())
return;
MailerResult result = new MailerResult();
MailPackage reMailing = new MailPackage(result, getWindowControl().getBusinessControl().getAsString(), true);
// leave course
LeavingStatusList status = new LeavingStatusList();
repositoryManager.leave(getIdentity(), getRepositoryEntry(), status, reMailing);
// leave groups
businessGroupService.leave(getIdentity(), getRepositoryEntry(), status, reMailing);
if (status.isWarningManagedGroup() || status.isWarningManagedCourse()) {
showWarning("sign.out.warning.managed");
} else if (status.isWarningGroupWithMultipleResources()) {
showWarning("sign.out.warning.mutiple.resources");
} else {
showInfo("sign.out.success", new String[] { getRepositoryEntry().getDisplayname() });
}
doClose(ureq);
}
Aggregations