Prerequisites

To get the most out of this guide, you’ll need to:

1. Install

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

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");

        SendEmailRequest sendEmailRequest = SendEmailRequest.builder()
                .from("Acme <onboarding@resend.dev>")
                .to("delivered@resend.dev")
                .subject("it works!")
                .html("<strong>hello world</strong>")
                .build();

         try {
            SendEmailResponse data = resend.emails().send(sendEmailRequest);
            System.out.println(data.getId());
        } catch (ResendException e) {
            e.printStackTrace();
        }
    }
}

3. Try it yourself

Java Examples

See the full source code.