Java
Introduction
Learn how to send your first email using the Resend Java SDK.
Prerequisites
To get the most out of this guide, you’ll need to:
1. Install
2. Send emails using HTML
Main.java
import com.resend.*;
public class Main {
public static void main(String[] args) {
Resend resend = new Resend("re_123456789");
CreateEmailOptions params = CreateEmailOptions.builder()
.from("Acme <onboarding@resend.dev>")
.to("delivered@resend.dev")
.subject("it works!")
.html("<strong>hello world</strong>")
.build();
try {
CreateEmailResponse data = resend.emails().send(params);
System.out.println(data.getId());
} catch (ResendException e) {
e.printStackTrace();
}
}
}
3. Try it yourself
Java Examples
See the full source code.
Was this page helpful?