This project is a Spring Boot application that integrates with Amazon Simple Email Service (SES) to send emails reliably and securely.
It demonstrates how to configure AWS SDK in a Spring application and send transactional or notification emails via Amazon SES.
- Send emails using Amazon SES
- Integration with Spring Boot and AWS SDK
- Configurable via environment variables (no credentials in code)
- Follows Clean Code principles for better readability and maintainability
- Secure development with GitHub Push Protection
- Java 17+
- Spring Boot
- AWS SDK for Java (SES)
- Maven
Before running the project, make sure you have:
- AWS Account with Amazon SES enabled
- Verified sender email address in SES
- Access Key & Secret Key from AWS IAM (with SES permissions)
The application uses environment variables (or ~/.aws/credentials) for security.
Export them in your shell:
export AWS_ACCESS_KEY_ID=your_access_key
export AWS_SECRET_ACCESS_KEY=your_secret_key
export AWS_REGION=us-east-1Or configure in ~/.aws/credentials:
[default]
aws_access_key_id=your_access_key
aws_secret_access_key=your_secret_key
region=us-east-1Clone the repository:
git clone https://github.com/renanbreier/Java-Email-Sender.git
cd Java-Email-SenderBuild and run with Maven:
mvn spring-boot:runOnce the application is running, you can trigger the email sending service by calling the method in your code or exposing an endpoint (/api/email).
Example (inside your service):
sesClient.sendEmail(new SendEmailRequest()
.withDestination(new Destination().withToAddresses("recipient@example.com"))
.withMessage(new Message()
.withSubject(new Content("Test Email from SES"))
.withBody(new Body().withText(new Content("Hello, this is a test email."))))
.withSource("your_verified_email@example.com"));- Make sure the sender email address is verified in Amazon SES.
- In sandbox mode, SES only allows sending to verified addresses. To lift restrictions, request production access in AWS.
- This project follows Clean Code practices such as meaningful names, small methods, separation of concerns, and proper package structure.
Renan Breier.