← Back to blog

Quarkus Transactional Email API (2026): Notify That a Report Is Ready from a JAX-RS Resource with POST /emails

Send a “your report is ready” notice from a Quarkus JAX-RS resource with Rovela’s HTTP API: a Bearer key from the process environment, JDK HttpClient to POST /emails, and an Idempotency-Key. Not a Quarkus OTP, Spring Boot, Micronaut, or send-email-java rewrite, and not an invented official Quarkus extension or Java SDK.

Updated November 11, 2026
Quarkus Transactional Email API (2026): Notify That a Report Is Ready from a JAX-RS Resource with POST /emails

A report-ready notice is not a Quarkus OTP tutorial, and it is not a Spring Boot tour

When a long-running report finishes writing to storage — a weekly usage export, a finance workbook, a compliance dump — the person who asked for it needs a clear message: “Your report is ready,” plus a link to download the file. That send is transactional email. It is not a newsletter, not a broadcast, and it is not a rewrite of the Quarkus OTP email guide, the Spring Boot transactional or Spring Boot OTP tours, the Micronaut transactional guide, or send email in Java. Those tutorials already exist, and they answer a different stack or a different lifecycle moment (a one-time code, a Spring @Service, a Micronaut client, or a language-level Java mailer). This one is a Quarkus JAX-RS resource: an imperative HTTP endpoint that sends after the report file is already stored.

Rovela’s Email API is a single HTTPS call for that work. There is no client library to install. The base URL is https://api.rovela.dev. You authenticate with Authorization: Bearer re_… (Authentication) and queue a message with POST /emails. The response is a message id. HTTP 200 means the message was accepted and queued, not that it has already arrived (Quick Start).

This guide stays inside documented Rovela fields on purpose. The examples use the JDK HttpClient from a JAX-RS resource, because the HTTP shape is the product — not an official Quarkus extension, not a Rovela Java SDK, and not a contacts, topics, or broadcasts product tour. The JSON body and headers are the same ones any runtime can send.

If you are still choosing between HTTP and SMTP, read Email API vs SMTP. Rovela’s SMTP is mailbox SMTP for mail apps (mx.rovela.dev:465, a device credential, send-as-self, 30 messages a minute from one client address). Programmatic volume from a Quarkus resource belongs on POST /emails, which is also the distinction drawn in Email API vs SMTP relay.

A Quarkus JAX-RS resource marks a report ready, then posts JSON to the email API and receives a message id

What you need before the first Quarkus send

The first-email guide and the Quick Start are the same five steps, whether your caller is a JAX-RS resource or any other server:

  1. Create an account. You start on the free plan, which sends real mail. There is no separate sandbox or test key.
  2. Add and verify a sending domain (a subdomain such as mail.example.com is a common choice). You cannot send from a domain you have not verified; an unverified or foreign from is refused with a 400 that names the domain. The dashboard asks for four DNS records — SPF, DKIM, DMARC, and return-path. See the domain setup guide and what domain email is.
  3. Create an API key. A sending_access key can send and nothing else — the right default for a production Quarkus process. A full_access key can also read messages and events, and manage domains, templates, and webhooks. The full key is shown once.
  4. Send with POST /emails.
  5. Confirm delivery in the dashboard, with GET /emails/:id or GET /emails/:id/events (those reads need full_access or a dashboard session), or with a webhook.

from is a string in the documented form "Reports <reports@yourdomain.com>". The address must sit on a verified sending domain. That is the same rule that makes domain email trustworthy: you prove you control the domain before you speak as it. How the display name and the address work is covered in the From name guide.

At least one of html, text, or template is required. Send both html and text where you can — many clients preview the text part, which is often where someone first sees that the report is actually ready (HTML email API).

A Quarkus JAX-RS resource that sends after the report is stored

Keep the key out of the browser, out of a public repository, out of a container image, and out of structured logs that print every environment variable. A leaked sending_access key can send mail as your domain. Read it with System.getenv in the Quarkus process, and call Rovela only from a server-side resource — never from a frontend, a mobile app, or a client that ships in a JAR users can unpack.

A compact Quarkus service might accept POST /reports/{id}/ready after a background job has written the file and stored a download URL. The resource below uses JAX-RS for routing and the JDK HttpClient for the outbound call. Jackson is already on the classpath in a typical Quarkus REST app; it is used here only to build JSON, and it is still not an official SDK:

package com.example.reports;

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;

import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;

@Path("/reports")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class ReportResource {

    private static final HttpClient HTTP = HttpClient.newBuilder()
            .connectTimeout(Duration.ofSeconds(10))
            .build();
    private static final ObjectMapper JSON = new ObjectMapper();

    public static class ReadyBody {
        public String to;
        public String downloadUrl;
    }

    @POST
    @Path("/{id}/ready")
    public Response reportReady(@PathParam("id") String id, ReadyBody in) throws Exception {
        String emailId = notifyReportReady(id, in.to, in.downloadUrl);
        ObjectNode out = JSON.createObjectNode();
        out.put("emailId", emailId);
        return Response.ok(out).build();
    }

    static String notifyReportReady(String reportId, String to, String downloadUrl) throws Exception {
        ObjectNode tags = JSON.createObjectNode();
        tags.put("type", "report_ready");
        tags.put("report_id", reportId);

        ObjectNode payload = JSON.createObjectNode();
        payload.put("from", "Reports <reports@mail.example.com>");
        payload.put("to", to);
        payload.put("subject", "Your report is ready");
        payload.put("html",
                "<p>Your report is ready.</p><p><a href=\"" + downloadUrl + "\">Download the report</a></p>");
        payload.put("text", "Your report is ready. Download it: " + downloadUrl);
        payload.put("reply_to", "ops@mail.example.com");
        payload.set("tags", tags);

        HttpRequest req = HttpRequest.newBuilder()
                .uri(URI.create("https://api.rovela.dev/emails"))
                .timeout(Duration.ofSeconds(15))
                .header("Authorization", "Bearer " + System.getenv("ROVELA_API_KEY"))
                .header("Content-Type", "application/json")
                .header("Idempotency-Key", "report-ready-" + reportId)
                .POST(HttpRequest.BodyPublishers.ofString(JSON.writeValueAsString(payload)))
                .build();

        HttpResponse<String> res = HTTP.send(req, HttpResponse.BodyHandlers.ofString());
        if (res.statusCode() != 200) {
            throw new IllegalStateException("send failed " + res.statusCode() + ": " + res.body());
        }
        return JSON.readTree(res.body()).path("id").asText();
    }
}

tags are documented as arbitrary labels and are returned with the message, which makes later debugging in the dashboard or in a webhook payload much easier (email API tags). reply_to is optional; use it when the recipient should write back to an operations mailbox rather than to the from address (email API reply-to). Put ROVELA_API_KEY in the Quarkus process environment (email API authentication) — for example a Kubernetes secret or a Quarkus env mapping — and never bake it into the container image.

The same request is a short curl you can keep in a runbook while you are wiring the resource:

curl -X POST https://api.rovela.dev/emails \
  -H "Authorization: Bearer re_your_sending_key" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: report-ready-rpt_01J8K2" \
  -d '{
    "from": "Reports <reports@mail.example.com>",
    "to": "ada@example.com",
    "subject": "Your report is ready",
    "html": "<p>Your report is ready.</p><p><a href=\"https://app.example.com/reports/rpt_01J8K2\">Download the report</a></p>",
    "text": "Your report is ready. Download it: https://app.example.com/reports/rpt_01J8K2",
    "reply_to": "ops@mail.example.com",
    "tags": {"type": "report_ready", "report_id": "rpt_01J8K2"}
  }'

A successful body is {"object": "email", "id": "9f1c2e40-..."}. Persist that id next to the report record if you want a support trail; do not treat it as proof of delivery.

The JAX-RS annotations — @Path, @POST, @PathParam — are the reason this is not a Spring Boot article, not a Micronaut tour, and not a generic send-email-java example. The resource, not a @Scheduled job or an invented mail extension, is what calls Rovela. The outbound client is still plain HTTP, which is the documented way to talk to the API.

Idempotency, recipients, and what a 200 actually means

Background jobs and JAX-RS resources retry. A worker can POST /reports/{id}/ready twice if the first attempt timed out after Rovela had already accepted the message. Send an Idempotency-Key header (up to 256 characters) keyed to the report id (report-ready-<reportId>). A retry of the same request within 24 hours returns the original response instead of sending again (idempotency).

A message may address at most 50 recipients across to, cc, and bcc combined. That is the transport’s limit, not a plan limit, and it is checked before the request is accepted. Quota is charged per recipient, not per message — cc and bcc count the same as to. A report-ready notice almost always has one to (the requester). If you also notify a finance or compliance mailbox, remember that they count.

If you ever need to notify many independent report owners in one go, POST /emails/batch accepts up to 100 messages, each with the same schema. Two fields are rejected rather than ignored: template and topic_id. Send those through POST /emails. See the batch example and the batch transactional email guide. Each item should still carry its own business key if you send them as individual POST /emails calls; if you use the batch endpoint, keep the rest of the payload identical to a single send, without template or topic_id.

template is documented as { id, variables } and is mutually exclusive with html and text. This tutorial sends both html and text so the download link is visible in the notification preview. If you later switch to a stored template, use POST /emails (not batch) and follow the Templates API and the templates guide.

Errors you should handle in the JAX-RS resource

Documented send errors use an envelope of { statusCode, name, message }:

  • 400 — a missing required field, a from domain that does not belong to your organization, a template that does not exist, or more than 50 recipients on one message. Fix the payload; retrying the same body will fail the same way.
  • 401 — a missing or invalid credential, or a sending_access key used to read, reschedule, or cancel a message. Check the secret the Quarkus process is actually reading.
  • 429 — rate limit exceeded. Each message in a batch counts individually. Back off and retry with the same Idempotency-Key (email API retries, rate limits).

Map 400 and 401 to a non-retryable failure, and 429 to a retry with the same key, so a typo in from does not spin a reactive or scheduled retry loop. Broader patterns are in Email API error handling. Domain management endpoints such as GET /domains return 403 for a sending_access key — that is expected; leave domain work to the dashboard or a full_access key (Domains API, sending domains API).

Do not conflate this send with a Quarkus OTP message. A report-ready notice is a file that already exists, with a download URL and a stable report id. A one-time code is a different email, with a different subject, a short-lived secret in the body, and a different idempotency key.

Delivery is asynchronous — do not poll from the resource

A 200 from POST /emails means accepted for delivery, not delivered. Reading GET /emails/:id or GET /emails/:id/events needs a full_access key or a dashboard session; a sending_access key cannot do it, and you should not add a polling loop inside the JAX-RS method. Subscribe to a webhook instead, and verify the signature header x-resend-signature as documented in webhook security and signature verification. Event names include accepted, delivered, opened, clicked, bounced, or failed. For a single message you can also use the email delivery status API or the dashboard from a support session.

POST /emails/:id/cancel can cancel a message that has not been sent yet, which is relevant if you used scheduled_at (a documented ISO 8601 timestamp in the future) and the report was later revoked. Reading, rescheduling, and cancelling need full_access or a dashboard session. A request body for rescheduling is not documented here, so this guide does not invent one. Scheduling patterns are also covered in scheduled email sending.

A Quarkus OTP, Spring Boot, or Micronaut send is a different tutorial; a JAX-RS resource posts a report-ready notice with POST /emails

What not to do in a Quarkus project

  • Do not put the Rovela key in a public frontend, a mobile app binary, or a container image. Keep it in the process environment.
  • Do not install or advertise an official Rovela Quarkus extension or Java SDK — there isn’t one in this guide, and inventing one would be a product claim we cannot make. Use the JDK HttpClient.
  • Do not copy a Quarkus OTP, Spring Boot, Micronaut, or send-email-java article and swap the subject line. The stack and the lifecycle moment are different, and the call to action here is “download the report.”
  • Do not send from mailbox SMTP for this. SMTP is for mail apps and mailboxes. A Quarkus resource should use the HTTP API.
  • Do not skip domain verification. An unverified from is refused. If you send on behalf of several tenants, a key restricted to a single domain limits the blast radius of a leak (Email API for multi-tenant SaaS).

A compact Quarkus checklist

  1. Verify the sending domain and create a sending_access key (Quick Start).
  2. Put ROVELA_API_KEY in the Quarkus process environment, not in the container image or the browser.
  3. After the report file is stored, POST https://api.rovela.dev/emails from a JAX-RS resource with the JDK HttpClient.
  4. Send both html and text, include the download URL, and set Idempotency-Key to report-ready-<reportId>.
  5. Optionally set reply_to and tags such as type=report_ready.
  6. Handle 400, 401, and 429 from the error envelope. Confirm delivery with a webhook, not by polling inside the resource.
  7. If you are comparing providers, the existing pages are Rovela vs Mailgun, vs Amazon SES, vs Postmark, vs SendGrid, vs Resend, and vs Brevo. For the HTTP shape itself, see the transactional email API, the curl sending guide, and the HTTP email API overview. For other notification patterns, see the email notification API guide.

That is the whole integration: a report you already finished writing, one HTTPS POST from a JAX-RS resource, and a download link the requester can act on.