Send email using AWS SES from template with custom data and attachment in Spring

921 Views Asked by At

I have Spring Boot application and I would like to send email using AWS SES SDK. I have templates for emails (added in SES) with placeholders to put some custom data/strings. Email should also contain attachment (pdf file).

I found this solution https://stackoverflow.com/a/69400797/3626048 to load template from SES and use RawEmail to send with attachment (https://docs.aws.amazon.com/code-samples/latest/catalog/javav2-ses-src-main-java-com-example-ses-SendMessageAttachment.java.html). But my problem is that in RawEmail I can't fill placeholders in my templates.

I could find and replace placeholders using String.replaceAll() method but is there any better solution?

0

There are 0 best solutions below