我正在尝试实现向CC中的多个收件人发送订单确认邮件的功能。任何人都有想法请帮助。
提前致谢。
答案 0 :(得分:3)
一种解决方案是扩展de.hybris.platform.acceleratorservices.email.impl.DefaultEmailGenerationService
。有一种方法 createEmailMessage ,可在生成方法中生成并返回 EmailMessageModel 。在此MessageModel上,您可以设置所需的属性。一个示例代码片段就是这样的。
public class MyEmailGenerationService extends DefaultEmailGenerationService implements EmailGenerationAndSendService {
@Override
public EmailMessageModel generate(final BusinessProcessModel businessProcessModel, final EmailPageModel emailPageModel)
throws RuntimeException {
//Make a check for your businessProcessModel if it is
if (businessProcessModel instanceof OrderProcessModel) {
EmailMessageModel myCustomMessage = super.createEmailMessage("Your Subject", "Your body", emailContext);
myCustomMessage.setCcAddresses(new ArrayList<EmailAddressModel>()); // Here add the list of the cc you want to send.
}
}
}