Send emails with Java
Prerequisites
Section titled “Prerequisites”Before you start, you'll need:
- A Resend API key
- A verified domain
Install
Gradle implementation 'com.resend:resend-java:+'Maven <dependency> <groupId>com.resend</groupId> <artifactId>resend-java</artifactId> <version>LATEST</version> </dependency>Send emails using HTML
Main.java import com.resend.*; public class Main { public static void main(String[] args) { Resend resend = new Resend("re_xxxxxxxxx"); 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(); } } }
Examples
Section titled “Examples”Basic Send
Basic email sending
Attachments
Send emails with file attachments
Templates
Send emails using Resend hosted templates
Scheduling
Schedule emails for future delivery
Audiences
Manage contacts and audiences
Domains
Create and manage sending domains
Inbound Webhooks
Receive and process inbound emails
Double Opt-in
Double opt-in subscription flow
Javalin App
Full Javalin web framework application
Spring Boot App
Full Spring Boot application