Skip to main content
Resend Docs
current

Search documentation

Type to search this documentation.

On this pageOverview

Send emails with Java

Learn how to send your first email using the Resend Java SDK.

Before you start, you'll need:

  1. Install

    Gradle
    implementation 'com.resend:resend-java:+'
    Maven
    <dependency>
        <groupId>com.resend</groupId>
        <artifactId>resend-java</artifactId>
        <version>LATEST</version>
    </dependency>
  2. 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();
            }
        }
    }
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu