What client library for Java should I use?

Hi, are there any client libraries for Java that best works with Mailsac? There’s a lot and I don’t know which ones are the most effective and most compatible with Mailsac.


Hey @axis, welcome and thanks for the question. Depending on what you want to do, there are a few options.

For interacting with the REST API, your best bet is probably generating a Java Mailsac client library using the OpenAPI (formerly Swagger) spec.

The spec can be downloaded from https://mailsac.com/docs/api - look for “Download” button.


In the future we hope generate libraries automatically in our CI, and publish to maven (as well as other languages & repos).

If the above doesn’t work for you, please try using Unirest. For every REST endpoint at mailsac.com/docs/api, we generate “Java + Unirest" code snippets. You’ll still have to parse the response JSON string into a class instance, hash or array of objects.

The above recommendations were for managing email over REST. If you’re receiving email over web sockets, the best bet is using a library like https://github.com/TooTallNate/Java-WebSocket. We don’t currently have any code samples for Java, but check out the JavaScript samples to get a general idea: https://docs.mailsac.com/en/latest/services/websocket/websocket.html