Harbur — High-performance infrastructure platform. Now available.
Client SDKs

Java SDK

The official Harbur Java client library. Compatible with Java 11+, Spring Boot, Android, and Quarkus with zero third-party dependencies.

Java 11+ & 17 / 21Maven & GradleZero Dependencies

Installation

Maven

pom.xml
<dependency>
    <groupId>com.harbur</groupId>
    <artifactId>harbur-sdk</artifactId>
    <version>1.0.0</version>
</dependency>

Gradle

groovy
implementation 'com.harbur:harbur-sdk:1.0.0'

Basic Usage

Initialize the client. It automatically detects HARBUR_API_KEY from environment variables.

Main.java
import com.harbur.Harbur;
import com.harbur.Harbur.EmailOptions;
import com.harbur.Harbur.SendResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        // Reads HARBUR_API_KEY from environment automatically
        Harbur harbur = new Harbur();

        SendResponse response = harbur.emails().send(
            new EmailOptions()
                .from("support@yourdomain.com")
                .to("customer@example.com")
                .subject("Welcome to Harbur!")
                .html("<h1>Welcome aboard!</h1><p>Transactional email delivered via Java.</p>")
                .text("Welcome aboard! Transactional email delivered via Java.")
        );

        System.out.println("Dispatched Message ID: " + response.id);
    }
}

Note

Set HARBUR_API_KEY in your environment variables.

CC, BCC & Custom Reply-To

Advanced.java
import com.harbur.Harbur;
import com.harbur.Harbur.EmailOptions;

public class Advanced {
    public static void sendReceipt(Harbur client) throws Exception {
        client.emails().send(
            new EmailOptions()
                .from("support@yourdomain.com")
                .to("client@example.com")
                .cc("accounting@example.com")
                .bcc("archive@example.com")
                .replyTo("helpdesk@yourdomain.com")
                .subject("Invoice #1042 Ready")
                .html("<p>Your invoice is ready for review.</p>")
        );
    }
}

File Attachments

Pass file bytes with new Attachment("invoice.pdf", bytes, "application/pdf"):

Attachments.java
import com.harbur.Harbur;
import com.harbur.Harbur.Attachment;
import com.harbur.Harbur.EmailOptions;
import java.nio.file.Files;
import java.nio.file.Paths;

public class Attachments {
    public static void sendWithPdf(Harbur client) throws Exception {
        byte[] pdfBytes = Files.readAllBytes(Paths.get("invoice.pdf"));

        client.emails().send(
            new EmailOptions()
                .from("billing@yourdomain.com")
                .to("client@example.com")
                .subject("Your Invoice #1042")
                .html("<p>Your receipt is attached below.</p>")
                .attach(new Attachment("invoice_1042.pdf", pdfBytes, "application/pdf"))
        );
    }
}

Spring Boot Integration

NotificationService.java
package com.example.service;

import com.harbur.Harbur;
import com.harbur.Harbur.EmailOptions;
import org.springframework.stereotype.Service;

@Service
public class NotificationService {
    private final Harbur harbur = new Harbur();

    public void sendOrderConfirmation(String email, String orderId) throws Exception {
        harbur.emails().send(
            new EmailOptions()
                .from("orders@yourdomain.com")
                .to(email)
                .subject("Order #" + orderId + " Confirmed")
                .html("<h1>Thank you for your order #" + orderId + "!</h1>")
        );
    }
}