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

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?

Related

Programmatically signing/encrypting Spring emails using GPG private-key

I am trying to set up a service which needs to notify users via email from time to time using Java + Spring Boot 3.0.2.
I want the service to be able to search online public-key stores for a recipient and encrypt the message or if no public-key is found, simply sign the message with its own key.
I am using org.springframework.boot:spring-boot-starter-mail:3.0.2 and sending simple unencrypted/unsigned emails was up and running in no time using the org.springframework.mail.SimpleMailMessage type.
However, I cant seem to find any library or method of properly integrating GnuPG public-keys into sending emails. There is plenty of examples of using GPG for files, text etc. but how to use it for emails eludes me.
I have a working POC using the org.springframework.mail.SimpleMailMessage as message-type and org.springframework.mail.javamail.JavaMailSenderImpl for sending the email.
I have not found a library or a clear description of how to manually sign/encrypt mail-content, which is the root of this question.

Sending email with attachments submitted from form using apache commons HTML Email without using any temporary storage

I have a form which through which attachments are submitted and at java side I need to send an email with those attachments without storing attachment temporary anywhere. Is it possible to do that ?
my code looks like
email.attach(fileDataSource,fileName,fileName)

How to Send email to multiple recipient using sendgrid

HiAm trying to send email using send grid using spring boot rest api,am able to sedn only one recipient but am not able to send multiple recipient can anyone know how we can send email multiple recipient using sendgrid

File handling in cloud micro service

I am building an email micro service that is responsible for sending emails , now to be able to handle mail attachment I have two options
Save file to a shared repository
Embed the file in the stream message
What is the best approach for this knowing that email attachment might be up to 5 MB
If it is possible to claim check the attachment (solution 1), I would recommend that.

How do I compose a Gmail message with an attachment from a URL?

I am writing a little script in Ruby that searches for a file in a directory and creates a new Gmail message to send. It should have the name of the file in the subject field, and the file as an attachment.
I have this URL http://pastie.org/3240209 which gets me to the compose page of Gmail, and fills the subject with the name of a PDF file.
I want to add this file as an attachment. Can I do that somehow through the URL?
If you have to send something with gmail, you should not be doing it that way. Google exposes gmail through standard IMAP and SMTP. You can use oauth to connect to these services in ruby. See http://code.google.com/apis/gmail/oauth/. You can use oauth along with the ruby standard SMTP library to send gmail then.

Resources