Package com.easydesk.notification.email
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
-
Field Summary
Fields inherited from interface com.easydesk.notification.email.EmailTemplateService
LAYOUTS, SUBJECTFields inherited from interface com.easydesk.notification.NotificationConstants
ACTIVITIES, ACTIVITY_SET, DEFAULT_TEXT, DEFAULT_TEXT_KEY, FORMAT_TOOL, FRIST_STATUS, GLOBAL_TOOL, HIDE_MESSAGE_INFO, ITEM, ITEM_TYPE_NAME, LINK, LOCALE, LOCALIZATION_TOOL, MATH_TOOL, MODEL, MODULE, MODULE_NAME, NO_REPLY_TO_ADDRESS, NOTIFICATION_TYPE, NUMBER_TOOL, RENDERER, STATIC_LINK, USER -
Constructor Summary
ConstructorsConstructorDescriptionDefaultEmailTemplateServiceImpl(NotificationMailProperties properties, NotificationRenderer renderer, EmailLinkFactory linkFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoidsend(NotificationContext context, Module module, InternetAddress fromUser, InternetAddress replyToUser, Collection<InternetAddress> toUsers, Collection<InternetAddress> ccUsers, String template, Locale locale, Collection<NotificationStatus> statuss) 수신자(toUsers) 한 명마다 메일을 하나씩 동기 발송한다.
-
Constructor Details
-
DefaultEmailTemplateServiceImpl
@Autowired public DefaultEmailTemplateServiceImpl(NotificationMailProperties properties, NotificationRenderer renderer, EmailLinkFactory linkFactory)
-
-
Method Details
-
send
public void send(NotificationContext context, Module module, InternetAddress fromUser, InternetAddress replyToUser, Collection<InternetAddress> toUsers, Collection<InternetAddress> ccUsers, String template, Locale locale, Collection<NotificationStatus> statuss) throws Exception Description copied from interface:EmailTemplateService수신자(toUsers) 한 명마다 메일을 하나씩 동기 발송한다. 하나라도 실패하면 예외를 던진다 - 호출한 쪽 (BatchNotificationManager)이 DEFERRED/FAIL 처리를 한다.- Specified by:
sendin interfaceEmailTemplateService- Parameters:
context- template 변수module- 메일을 발송하는 module (SMTP domain 선택에 사용)fromUser- 보내는 사람replyToUser- 답장 받을 사람 (null 가능)toUsers- 받는 사람ccUsers- 참조 (null 가능)template- NotificationType 의 template 이름locale- 수신자 localestatuss- 이 메일이 통지하는 NotificationStatus (추적용 header 에 사용)- Throws:
Exception
-