Skip to main content

Prerequisites

To get the most out of this guide, you’ll need to:
You can find your API keys in your SendPost Dashboard. Make sure to use your Sub-Account API Key for sending emails.

1. Add Dependency

Maven

Add to pom.xml:
POM

Gradle

Add to build.gradle:
Gradle

2. Configuration

Add to application.properties:
Or application.yml:

3. Create Email Service

Create src/main/java/com/example/service/EmailService.java:
Java

4. Create REST Controller

Create src/main/java/com/example/controller/EmailController.java:
Java

5. Request DTOs

Create DTOs:
Java

6. Using Async Email Sending

Create async service:
Java
Enable async:
Java
Make sure your sender email domain is verified in your SendPost account before sending emails.

7. Next Steps

Explore more examples and use cases:

Spring Boot Documentation

Learn more about Spring Boot

SendPost Java SDK

View the official SDK on GitHub

Quickstart Example

View a complete working example on GitHub