Search in sources :

Example 1 with InvitationSentEvent

use of cz.metacentrum.perun.audit.events.MailManagerEvents.InvitationSentEvent in project perun by CESNET.

the class MailManagerImpl method sendInvitationMail.

/**
 * Send invitation email to one user
 */
private void sendInvitationMail(PerunSession sess, Vo vo, Group group, String email, String language, MimeMessage message, Application app) throws RegistrarException {
    try {
        mailSender.send(message);
        User sendingUser = sess.getPerunPrincipal().getUser();
        AuditEvent event = new InvitationSentEvent(sendingUser, email, language, group, vo);
        sess.getPerun().getAuditer().log(sess, event);
        log.info("[MAIL MANAGER] Sending mail: USER_INVITE to: {} / {} / {}", message.getAllRecipients(), app.getVo(), app.getGroup());
    } catch (MailException | MessagingException ex) {
        log.error("[MAIL MANAGER] Sending mail: USER_INVITE failed because of exception.", ex);
        throw new RegistrarException("Unable to send e-mail.", ex);
    }
}
Also used : InvitationSentEvent(cz.metacentrum.perun.audit.events.MailManagerEvents.InvitationSentEvent) MessagingException(javax.mail.MessagingException) AuditEvent(cz.metacentrum.perun.audit.events.AuditEvent) RegistrarException(cz.metacentrum.perun.registrar.exceptions.RegistrarException) MailException(org.springframework.mail.MailException)

Aggregations

AuditEvent (cz.metacentrum.perun.audit.events.AuditEvent)1 InvitationSentEvent (cz.metacentrum.perun.audit.events.MailManagerEvents.InvitationSentEvent)1 RegistrarException (cz.metacentrum.perun.registrar.exceptions.RegistrarException)1 MessagingException (javax.mail.MessagingException)1 MailException (org.springframework.mail.MailException)1