Email sending service using AWS Simple Email Service (SES) with Spring Boot and AWS SDK v2.
This service allows you to send emails programmatically using AWS SES. It's built with a modular architecture and utilizes Spring Boot dependecy injection. The service supports:
- Sender and recipient configuration.
- Plain text email body.
- AWS region and credentials configuration via
application.propertiesor environment variables.
- Java 21+.
- Maven.
- AWS account with SES enabled.
- E-mail(s) verified in SES (sandbox or production).
- Spring Boot 3.5.6+
POST /send-email
Request Body (JSON):
{
"to": "teste@gmail.com",
"subject":"teste aws ses",
"body": "Hello from test"
}email-service/
│
├─ src/
│ ├─ main/
│ │ ├─ java/
│ │ │ └─ com/
│ │ │ └─ vitoriadeveloper/
│ │ │ └─ emailservice/
│ │ │ ├─ core/
│ │ │ │ └─ exceptions/
│ │ │ │ └─ EmailServiceException.java
│ │ │ │ └─ EmailRequest.java
│ │ │ │ └─ EmailSenderUseCase.java
│ │ │ │
│ │ │ ├─ application/
│ │ │ │ └─ EmailSenderService.java
│ │ │ │
│ │ │ ├─ adapters/ # input and outputs
│ │ │ │ └─ EmailSenderGateway.java # Interface
│ │ │ │
│ │ │ ├─ infra/
│ │ │ │ ├─ aws/
│ │ │ │ │ ├─ AwsConfig.java # SES Bean
│ │ │ │ ├─ ses/
│ │ │ │ │ └─ SesEmailSender.java # implementing SES
│ │ │ │
│ │ │ └─ controllers/
│ │ │ └─ EmailSenderController.java # Endpoint REST