The JavaMail way, and the shorter one
JavaMail (now Jakarta Mail) is fine software from a different era: Properties objects, Session factories, MimeMessage assembly, Transport.send. Pages of ceremony for one email, plus SMTP credentials to manage.
java.net.http.HttpClient has shipped with the JDK since 11. One request replaces the ceremony.
One POST, and the send is handled
var body = """ {"from":"[email protected]","to":"[email protected]", "subject":"Welcome","html":"<p>You're in.</p>"}"""; HttpRequest.newBuilder() .uri(URI.create("https://api.nitrosend.com/v1/my/messages")) .header("Authorization", "Bearer " + System.getenv("NITROSEND_API_KEY")) .POST(HttpRequest.BodyPublishers.ofString(body)) .build();
Spring shop? The same POST through RestClient or WebClient, and you can delete spring-boot-starter-mail from the pom entirely.
If your team worries about what agent-driven email means for control, here is our own usage data: the two screens with the highest human dwell time on the platform are the campaign editor and the flow editor. That is where people approve, tweak, and ship what agents built. The machines draft. The humans sign.
For teams that want typed clients rather than hand-built requests: the full OpenAPI spec lives at api.nitrosend.com/openapi.yaml, kept validated on every change. Point your generator at it and get a Java client that matches the API exactly.
Two enterprise details we built deliberately, because Java shops keep asking: multiple custom sending domains on one account, without the old hack of splitting your company into fake brands to get them, and a billing model designed around the 500,000 to 4,000,000 emails a month band rather than treating that volume as an edge case.
Full parameters, responses, and error codes live in the REST API docs and the API reference.
And the part no library gives you
The same account exposes an MCP server, so the agent writing your code can also run your email. Point Claude, Cursor, or Codex at api.nitrosend.com/mcp and it composes, previews, and stages sends, with a human approving every one. The API is for your code. The MCP is for your agent. One platform either way.
Every send comes back with a message ID, and delivery events follow on your webhook: delivered, opened, bounced. No dashboard required to know what happened.