Skip to content

resend/resend-java-legacy

Repository files navigation

Resend is the email platform for developers.

SDK Installation

Gradle

implementation 'com.resend.api:sdk:1.5.3'

Maven

<dependency>
    <groupId>com.resend.api</groupId>
    <artifactId>sdk</artifactId>
    <version>1.5.3</version>
</dependency>

Authentication

To authenticate you need to add an Authorization header with the contents of the header being Bearer re_123456789 where re_123456789 is your API Key. First, you need to get an API key, which is available in the Resend Dashboard.

Authorization: Bearer re_123

SDK Example Usage

package hello.world;

import com.resend.sdk.Resend;
import com.resend.sdk.models.shared.Security;
import com.resend.sdk.models.operations.SendEmailRequest;
import com.resend.sdk.models.operations.SendEmailResponse;
import com.resend.sdk.models.shared.Email;

public class Application {
    public static void main(String[] args) {
        try {
            Resend.Builder builder = Resend.builder();

            builder.setSecurity(
                new Security() {{
                    bearerAuth = "Bearer YOUR_BEARER_TOKEN_HERE";
                }}
            );

            Resend sdk = builder.build();

            SendEmailRequest req = new SendEmailRequest() {{
                request = new Email() {{
                    bcc = "bob@acme.com";
                    cc = "";
                    from = "me@acme.com";
                    html = "none";
                    replyTo = "";
                    subject = "hello world";
                    text = "first email";
                    to = "amy@acme.com";
                }};
            }};

            SendEmailResponse res = sdk.email.sendEmail(req);

            if (res.sendEmailResponse.isPresent()) {
                // handle response
            }
        } catch (Exception e) {
            // handle exception
        }

SDK Available Operations

email

  • sendEmail - Send an email

Contributions

While we value open-source contributions to this SDK, this library is generated programmatically. Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release !

SDK Generated by Speakeasy