Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.paubox.com/llms.txt

Use this file to discover all available pages before exploring further.

1

Add the JAR

Download Paubox.Email.API.jar from the repository and add it to your project’s classpath. See Installation for IDE and Maven instructions.
2

Create config.properties

Create a config.properties file in your project:
APIKEY=YOUR_API_KEY
APIUSER=YOUR_USERNAME
To obtain credentials, see Authentication.
3

Load credentials and send an email

import com.paubox.service.EmailService;
import com.paubox.data.*;
import com.paubox.config.ConfigurationManager;

public class SendEmail {
    public static void main(String[] args) throws Exception {

        // Load credentials from config.properties
        ConfigurationManager.getProperties("config.properties");

        // Build the message
        Header header = new Header();
        header.setFrom("sender@yourdomain.com");
        header.setSubject("Your first Paubox email");

        Content content = new Content();
        content.setPlainText("This message was sent with the Paubox Java SDK.");

        Message message = new Message();
        message.setRecipients(new String[]{"recipient@example.com"});
        message.setHeader(header);
        message.setContent(content);

        // Send
        EmailService service = new EmailService();
        SendMessageResponse response = service.sendMessage(message);

        System.out.println("Sent. Tracking ID: " + response.getSourceTrackingId());
    }
}
4

Check delivery status

GetEmailDispositionResponse disposition =
    service.getEmailDisposition(response.getSourceTrackingId());

for (MessageDeliveries delivery :
     disposition.getData().getMessage().getMessageDeliveries()) {
    System.out.println(delivery.getRecipient()
        + " → " + delivery.getStatus().getDeliveryStatus());
}

Next steps