Class DefaultEmailTemplateServiceImpl

java.lang.Object
com.easydesk.notification.email.DefaultEmailTemplateServiceImpl
All Implemented Interfaces:
EmailTemplateService, NotificationConstants

@Service public class DefaultEmailTemplateServiceImpl extends Object implements EmailTemplateService, NotificationConstants
Spring JavaMailSender + Thymeleaf 로 구현한 EmailTemplateService.

예전 구현(Fulcrum CommonsEmailServiceImpl 상속 + Avalon lifecycle + commons-email + transport listener)과의 차이:

  • SMTP 설정은 NotificationMailProperties(easydesk.mail.*) 에서 읽고, domain 마다 JavaMailSenderImpl 을 하나씩 (lazy) 만든다.
  • 발송은 동기이다. 성공/실패를 transport listener 로 받던 방식(SENDING_MESSAGE_MAP + messageDelivered 등)을 없애고, 실패하면 예외를 던져 호출한 BatchNotificationManager 가 DEFERRED 처리하도록 했다. 성공 후 상태 갱신(SENT + onend workflow)은 호출한 HtmlNTManager 가 한다.
  • 메일 하나마다 link/staticLink 를 새로 만들어 template context 에 넣는다.

Bounce 주소: 예전 javadoc 에 설명이 있던 것처럼 envelope sender 는 JavaMail 의 mail.smtp.from property 로 정해진다. 필요하면 domain 별 설정에 추가할 수 있다(현재는 미지원).

Author:
Youngho Cho