import org.springframework.context.annotation.*;
import com.broadleafcommerce.notification.service.*;
import com.broadleafcommerce.notification.service.integration.SESMessageSender;
@Configuration
public class MyNotificationConfiguration {
// Step 1: Configure a SESMessageSender
@Bean
SESMessageSender sesMailSender() {
// The Broadleaf SESMessageSender requires a client.
// See SES documentation for configuration and setup.
AmazonSimpleEmailService awsClient =
AmazonSimpleEmailServiceClientBuilder.standard()
.withCredentials(getCredentials())
.withRegion(Regions.US_EAST_1).build();
return new SESMessageSender(awsClient);
}
// Step 2: Register an EMAIL handler with the NotificationService
@Bean
NotificationHandler sesMailNotificationHandler(ThymeleafMessageBuilder builder,
SESMessageSender sender) {
return new DefaultNotificationHandler(builder, sender);
}
}