A lightweight Java client for the Posta email API.
- Java 11+
- Jackson Databind
Add the JitPack repository to your pom.xml:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>Then add the dependency:
<dependency>
<groupId>com.github.jkaninda</groupId>
<artifactId>posta-java</artifactId>
<version>1.0.0</version>
</dependency>repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.jkaninda:posta-java:1.0.0'
}import com.github.jkaninda.posta.*;
PostaClient client = new PostaClient("https://posta.example.com", "your-api-key");SendResponse response = client.sendEmail(new SendEmailRequest()
.from("sender@example.com")
.to(List.of("recipient@example.com"))
.subject("Hello")
.html("<h1>Hello World</h1>"));
// response.getId(), response.getStatus()SendResponse response = client.sendTemplateEmail(new SendTemplateEmailRequest()
.template("welcome")
.to(List.of("user@example.com"))
.templateData(Map.of("name", "John")));BatchResponse response = client.sendBatch(new BatchRequest()
.template("newsletter")
.recipients(List.of(
new BatchRecipient().email("alice@example.com").templateData(Map.of("name", "Alice")),
new BatchRecipient().email("bob@example.com").templateData(Map.of("name", "Bob"))
)));
// response.getTotal(), response.getSent(), response.getFailed()EmailStatusResponse status = client.getEmailStatus("email-uuid");
// status.getStatus(), status.getRetryCount()try {
client.sendEmail(request);
} catch (PostaException e) {
System.out.println(e.getStatusCode()); // HTTP status code
System.out.println(e.getMessage()); // Error message
}Contributions are welcome! Please open an issue to discuss proposed changes before submitting a pull request.
This project is licensed under the MIT License. See LICENSE for details.
Made with ❤️ for the developer community
⭐ Star us on GitHub — it motivates us to keep improving!
Copyright © 2026 Jonas Kaninda