added logging
This commit is contained in:
@ -20,6 +20,8 @@ import javax.mail.internet.InternetAddress;
|
|||||||
import javax.mail.internet.MimeBodyPart;
|
import javax.mail.internet.MimeBodyPart;
|
||||||
import javax.mail.internet.MimeMessage;
|
import javax.mail.internet.MimeMessage;
|
||||||
import javax.mail.internet.MimeMultipart;
|
import javax.mail.internet.MimeMultipart;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -27,6 +29,8 @@ import javax.mail.internet.MimeMultipart;
|
|||||||
*/
|
*/
|
||||||
@Stateless
|
@Stateless
|
||||||
public class MailService {
|
public class MailService {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(MailService.class);
|
||||||
|
|
||||||
@EJB
|
@EJB
|
||||||
private MailTemplateService mailTemplateService;
|
private MailTemplateService mailTemplateService;
|
||||||
@ -75,6 +79,7 @@ public class MailService {
|
|||||||
message.setContent(multipart, "text/html; charset=UTF-8");
|
message.setContent(multipart, "text/html; charset=UTF-8");
|
||||||
|
|
||||||
Transport.send(message);
|
Transport.send(message);
|
||||||
|
LOGGER.info ("Mail sent to "+recipient);
|
||||||
} catch (MessagingException | MailTemplateException ex) {
|
} catch (MessagingException | MailTemplateException ex) {
|
||||||
throw new MailException("Error while sending email.", ex);
|
throw new MailException("Error while sending email.", ex);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user