Skip to the documentation
Java

Install

One artifact on Maven Central, Java 17 and up, with no dependencies.

Install

The current release is 0.0.1. It has a method for every method of the TypeScript SDK, and the parity check of the package fails the build when one goes missing or sends a different request.

<dependency>    <groupId>uk.openemail</groupId>    <artifactId>openemail</artifactId>    <version>0.0.1</version></dependency>
FirstEmail.java
import java.util.Map;import uk.openemail.Body;import uk.openemail.OpenEmail; public final class FirstEmail {    public static void main(String[] args) {        OpenEmail client = new OpenEmail();         Map<String, Object> email = client.emails().send(Body.of(            "from", "Acme Billing <[email protected]>",            "to", "[email protected]",            "subject", "Your September invoice",            "html", "<p>Invoice attached.</p>"        ));         System.out.println(email.get("id") + " " + email.get("status"));    }}

new OpenEmail() reads the key from OPENEMAIL_API_KEY, so the code holds no credential. Use OpenEmail.builder().apiKey(...) when your configuration lives somewhere else.

A request body is a Map<String, Object> whose keys keep the names of the API, so scheduledAt is written the same way here as in the API reference. Body.of builds one that keeps the order you wrote it in and takes null values. A response is the decoded JSON as a Map<String, Object>, so email.get("id") reads the id.

send returning does not mean the message has gone. A scheduled or cancellable send comes back queued or scheduled and settles later. Read status, not the fact that the call returned.

Where it runs

Java 17 and up, on any JVM language. The jar has no dependency, and it names its module uk.openemail for applications on the module path.

The client is immutable and safe to share between threads. Build one when the application starts and keep it: it holds one HttpClient, which reuses its connections.

The client carries a workspace API key that can send mail and read the mailbox, so it belongs on a server, in a job or in a tool that runs on your own machine. Keep the key in an environment variable or a secrets store, never in code.