Announcing the Java SDK

Now you can send emails using the official Resend SDK for Java apps.

Kewyn AkshlleyKewyn Akshlley

In the world of object-oriented programming, the quality of the developer experience with SDKs depends on the freedom users have to customize and extend the existing features to suit their needs. The more space for creativity they have, the better.

So, to provide a unique experience sending emails, managing domains and API keys using the JVM (Java Virtual Machine), we developed a Java SDK to expand the capabilities and features of Resend.

Getting started

To install the Resend Java SDK, add the following dependency to your project:

Gradle:

implementation 'com.resend:resend-java:2.0.0'

Maven:

<dependency>
<groupId>com.resend</groupId>
<artifactId>resend-java</artifactId>
<version>2.0.0</version>
</dependency>

Construct your email and easily send it by using our client;

package com.resend;
import com.resend.*;
public class Main {
public static void main(String[] args) {
String apiKey = "re_123456789";
Resend client = new Resend(apiKey);
SendEmailRequest sendEmailRequest = SendEmailRequest.builder()
.from("Acme <onboarding@resend.dev>")
.to("delivered@resend.dev")
.subject("Hello World")
.html("<strong>It works!</strong>")
.build();
SendEmailResponse data = client.emails().send(sendEmailRequest);
System.out.println(data.getId());
}
}

You can also create new Domains with the Java SDK.

package com.resend;
import com.resend.*;
public class Main {
public static void main(String[] args) {
String apiKey = "re_123456789";
Resend client = new Resend(apiKey);
CreateDomainRequest params = CreateDomainRequest
.builder()
.name("example.com").build();
CreateDomainResponse domain = client.domains().create(params);
System.out.println(domain.getId());
}
}

To learn more, take a look in the documentation and try the full example.

If you would like to contribute to the Java SDK, check out the Github repository .

Next steps

In the future, we aim to expand our capabilities by incorporating additional JVM languages like Kotlin and creating a reactive version of the library to handle Mono and Flux data types.