Search in sources :

Example 1 with SubjectEmailTemplate

use of org.apache.openmeetings.service.mail.template.subject.SubjectEmailTemplate in project openmeetings by apache.

the class MailNotifier method notify.

@Override
public void notify(User u, Appointment a, Invitation inv) throws Exception {
    TimeZone tz = getTimeZone(u);
    SubjectEmailTemplate t = AppointmentReminderTemplate.get(u, a, tz);
    invitationManager.sendInvitationLink(inv, MessageType.Create, t.getSubject(), t.getEmail(), false);
}
Also used : SubjectEmailTemplate(org.apache.openmeetings.service.mail.template.subject.SubjectEmailTemplate) TimeZone(java.util.TimeZone) TimezoneUtil.getTimeZone(org.apache.openmeetings.db.util.TimezoneUtil.getTimeZone)

Example 2 with SubjectEmailTemplate

use of org.apache.openmeetings.service.mail.template.subject.SubjectEmailTemplate in project openmeetings by apache.

the class InvitationManager method sendInvitionLink.

/**
 * @author vasya
 *
 * @param a - appointment this link is related to
 * @param mm - attendee being processed
 * @param type - type of the message
 * @param ical - should iCal appoinment be attached to message
 * @throws Exception in case of error happens during sending
 */
private void sendInvitionLink(Appointment a, MeetingMember mm, MessageType type, boolean ical) throws Exception {
    User owner = a.getOwner();
    String invitorName = owner.getFirstname() + " " + owner.getLastname();
    TimeZone tz = getTimeZone(mm.getUser());
    SubjectEmailTemplate t;
    switch(type) {
        case Cancel:
            t = CanceledAppointmentTemplate.get(mm.getUser(), a, tz, invitorName);
            break;
        case Create:
            t = CreatedAppointmentTemplate.get(mm.getUser(), a, tz, invitorName);
            break;
        case Update:
        default:
            t = UpdatedAppointmentTemplate.get(mm.getUser(), a, tz, invitorName);
            break;
    }
    sendInvitationLink(mm.getInvitation(), type, t.getSubject(), t.getEmail(), ical);
}
Also used : SubjectEmailTemplate(org.apache.openmeetings.service.mail.template.subject.SubjectEmailTemplate) TimeZone(java.util.TimeZone) TimezoneUtil.getTimeZone(org.apache.openmeetings.db.util.TimezoneUtil.getTimeZone) User(org.apache.openmeetings.db.entity.user.User)

Example 3 with SubjectEmailTemplate

use of org.apache.openmeetings.service.mail.template.subject.SubjectEmailTemplate in project openmeetings by apache.

the class ReminderJob method remindExpiringRecordings.

public void remindExpiringRecordings() {
    log.trace("ReminderJob.remindExpiringRecordings");
    processExpiringRecordings(false, (rec, days) -> {
        if (days > 0) {
            User u = userDao.get(rec.getInsertedBy());
            if (u == null) {
                log.debug("Unable to send expiration email due to recording owner is NULL, {}", rec);
            } else {
                SubjectEmailTemplate templ = RecordingExpiringTemplate.get(u, rec, days);
                mailHandler.send(u.getAddress().getEmail(), templ.getSubject(), templ.getEmail());
            }
        } else {
            log.debug("Recording is too old to send notification, {} days", days);
        }
        rec.setNotified(true);
        recordingDao.update(rec);
    });
}
Also used : SubjectEmailTemplate(org.apache.openmeetings.service.mail.template.subject.SubjectEmailTemplate) User(org.apache.openmeetings.db.entity.user.User)

Aggregations

SubjectEmailTemplate (org.apache.openmeetings.service.mail.template.subject.SubjectEmailTemplate)3 TimeZone (java.util.TimeZone)2 User (org.apache.openmeetings.db.entity.user.User)2 TimezoneUtil.getTimeZone (org.apache.openmeetings.db.util.TimezoneUtil.getTimeZone)2