Skip to content

Latest commit

 

History

History
96 lines (68 loc) · 2.53 KB

File metadata and controls

96 lines (68 loc) · 2.53 KB

📧 Java Email Sender with Amazon SES

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.


🚀 Features

  • 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

🛠️ Technologies Used

  • Java 17+
  • Spring Boot
  • AWS SDK for Java (SES)
  • Maven

⚙️ Configuration

Before running the project, make sure you have:

  1. AWS Account with Amazon SES enabled
  2. Verified sender email address in SES
  3. Access Key & Secret Key from AWS IAM (with SES permissions)

Set your AWS credentials

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-1

Or configure in ~/.aws/credentials:

[default]
aws_access_key_id=your_access_key
aws_secret_access_key=your_secret_key
region=us-east-1

▶️ Running the Application

Clone the repository:

git clone https://github.com/renanbreier/Java-Email-Sender.git
cd Java-Email-Sender

Build and run with Maven:

mvn spring-boot:run

✉️ Sending an Email

Once 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"));

📌 Notes

  • 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.

📝 Author

Renan Breier.