Flarum Transactional Email API (2026): Notify an Author That Their Discussion Is Now Public with POST /emails
After a Flarum extender, listener, or queued job already records that a moderator approved a discussion topic and it is public, email the topic author the discussion permalink they already have using Rovela POST /emails. No official plugin. Rovela does not approve topics.
A discussion-is-now-public notice is not an account-approved, comment-mention, or listing-live mail
When a Flarum extender, a PHP listener, or a queued job has already recorded that a moderator approved a discussion topic — the topic is in a public, readable state, a topic permalink the author can open is already minted, the approval event is finished — that process still has to tell the topic author: “Your discussion is now public,” plus the topic permalink they already have. That send is transactional email. It is not a community digest, not a trending-topics newsletter, and it is not a rewrite of the Discourse account-approved, comment mention, or Joomla listing-is-live guides. Those tutorials already exist, and they describe a newly approved forum user being told they can now use a community, a person being told they were mentioned in a comment, or a directory owner being told that a listing is public. This article is one event in your own Flarum workflow: a pending discussion was approved by a moderator, the topic is now public, and a topic permalink already exists. Rovela does not approve Flarum discussions, hide or unhide posts, or talk to Flarum — this is your forum’s own discussion-is-now-public event, sent through POST /emails. The recipient is the topic author (the address you already store on that discussion). The call to action is “open the topic,” not “your forum account was approved,” not “someone mentioned you,” and not “your directory listing is live.”
Point the permalink at a URL the author can actually open now — the public discussion page Flarum already minted when the topic became visible. Do not attach a complete moderation worksheet, a private staff note, or a dump of every hidden reply unless you have a deliberate reason and the file is small enough for your own product rules; the documented call to action is the topic permalink they already have. Do not deep-link a moderator-only review queue the author cannot open. If the useful destination is simply the public discussion they just published, that URL is the right destination. There is no client library to install, and there is no official Rovela Flarum extension, extender, or marketplace plugin. Use a PHP HTTP client (cURL is enough; Guzzle is fine if your forum already depends on it) plus curl in a shell when you want to prove the JSON. The JSON body and headers are the product. The extender or queued job that already marked the discussion public should send the notice; Rovela does not change approval status and does not invent a Flarum product.
This is also not a rewrite of nearby CMS or community guides. The TYPO3 workspace-record-ready tutorial tells the next approver that a workspace record is waiting; it is not a public-discussion mail to an author. The WordPress, Drupal, Ghost, and Craft CMS tutorials already exist, and each of those has its own story. A Flarum “your discussion is now public” notice is a different caller and a different event. Nearby PHP guides such as Laravel transactional email, Symfony, CakePHP, CodeIgniter, Slim, Yii, and the general PHP transactional email overview cover other callers; they do not replace this discussion-is-now-public story. Rovela’s Email API is a single HTTPS call. 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 {"object":"email","id":"..."}. HTTP 200 means the message was accepted and queued, not that it has already arrived (Quick Start).
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 Flarum extender or queued job belongs on POST /emails, which is also the distinction drawn in Email API vs SMTP relay. Related reading on the HTTP shape includes the transactional email API, the simple transactional email API, and sending transactional email from an app.
What you need before the first discussion-is-now-public notice
The first-email guide and the Quick Start are the same five steps, whether the caller is curl or a PHP cURL helper inside a Flarum extender:
- Create an account. You start on the free plan, which sends real mail. There is no separate sandbox, and no test key that behaves differently from production.
- Add and verify a sending domain (a subdomain such as
mail.example.comis a common choice). You cannot send from a domain you have not verified; an unverified or foreignfromis 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, the Domains API, and what domain email is. - Create an API key. A
sending_accesskey can send and nothing else — the right default for a production discussion-is-now-public notifier. Afull_accesskey can also read messages and events, and manage domains, templates, and webhooks. The full key is shown once. - Send with
POST /emails. - Confirm delivery in the dashboard, with
GET /emails/:idorGET /emails/:id/events(those reads needfull_accessor a dashboard session), or with a webhook.
from is a string in the documented form "Community <community@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 and the sending domains API overview. Related reading on records and subdomains includes how email authentication works, how to set up domain email, and sending subdomain setup.
At least one of html, text, or template is required. template is a documented { id, variables } object and is mutually exclusive with html and text. Send both html and text where you can — many clients preview the text part, which is often where the author first sees the topic permalink (HTML email API). If you later store reusable copy in a template, follow the templates guide; this article keeps the copy inline so the extender stays easy to read.
A Flarum extender or queued job that sends after the discussion is already public
Keep the Rovela key out of the browser, out of a public repository, and out of a container image. A leaked sending_access key can send mail as your domain. The Flarum extender, PHP listener, or queued job that already marked the discussion public should read ROVELA_API_KEY from its process environment and call Rovela only on the server (email API authentication). If a moderator approves the topic in Flarum’s own review queue, write your own approved-and-public record first (status public and readable, topic permalink already minted and reachable by the author and by other members), then enqueue the notice. Do not call the Email API from a frontend JavaScript hook, and do not invent a Rovela Flarum plugin that changes approval — Rovela only sends the mail.
Store the event first: the discussion id you already have, a short topic title you already show on the discussion page, the author’s address, and the topic permalink they already have. The send is just the notice. The recipient is consistently the person who started the discussion — not every moderator, not every subscriber to the tag, and not a shared staff inbox unless you add that address deliberately. Key the Idempotency-Key to that discussion-is-now-public event so a retried queue worker does not mail the same “your discussion is now public” notice twice. A later approval for a different topic is a different event and should be a different key. If a later job hides the discussion or rejects a pending topic, those are different events, not this one.
<?php
// extend.php helper, or a queued job class.
// Flarum extender / listener. Plain cURL. No official Rovela Flarum plugin.
// Send only after a moderator has already approved the discussion and it is public.
function rovela_send_email(
string $to,
string $subject,
string $html,
string $text,
string $idempotencyKey,
string $fromAddress,
array $tags
): string {
$payload = [
"from" => "Community <{$fromAddress}>",
"to" => $to,
"subject" => $subject,
"html" => $html,
"text" => $text,
"reply_to" => $fromAddress,
"tags" => $tags,
];
$ch = curl_init("https://api.rovela.dev/emails");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("ROVELA_API_KEY"),
"Content-Type: application/json",
"Idempotency-Key: {$idempotencyKey}",
],
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_RETURNTRANSFER => true,
]);
$body = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($code < 200 || $code > 299) {
throw new RuntimeException("Rovela send failed: HTTP {$code}");
}
$decoded = json_decode($body, true);
return is_array($decoded) && isset($decoded["id"]) ? $decoded["id"] : "";
}
function notify_discussion_public(
string $authorEmail,
string $topicTitle,
string $topicPermalink,
string $discussionId
): string {
$safeTitle = htmlspecialchars($topicTitle, ENT_QUOTES | ENT_HTML5, "UTF-8");
return rovela_send_email(
$authorEmail,
"Your discussion is now public",
"<p>Your discussion “{$safeTitle}” is now public.</p><p><a href=\"{$topicPermalink}\">Open the topic</a></p>",
"Your discussion \"{$topicTitle}\" is now public.\n\nOpen the topic: {$topicPermalink}",
"discussion-public-{$discussionId}",
"community@yourdomain.com",
["type" => "discussion_public"]
);
}
Call notify_discussion_public from the extender, listener, or queued job that already wrote approved_at (or your own “public and readable” flag) — after the topic permalink exists and remains reachable, not before. A typical pattern is a Flarum extender that listens for your own “discussion approved” event after the record is persisted, or a queued job that drains a discussion_public queue your extender already enqueued. Keep the HTTP call out of the request path that merely submits a new topic; the author should be mailed when a moderator has actually approved the discussion and it is public, not when they first post a pending topic. The email is a status notice, not a place to dump a moderation score, a list of every tag, or a complete community handbook the author can already read once they open the topic. If a later decision hides the discussion, that is a different event and should use a different idempotency key — do not reuse the public key, and do not treat this mail as a comment mention notice.
If several topics become public in a short window and you genuinely need one HTTP call per batch of notices, POST /emails/batch accepts up to 100 messages and rejects template and topic_id. Most forums are better served by one idempotent POST /emails per discussion. topic_id is only a documented field on the single-send endpoint; this guide does not walk through a topics product.
Idempotency, recipients, and what a 200 actually means
Flarum queue workers retry, and a “the discussion is now public, notify the author” path can run more than once for the same record. Send an Idempotency-Key header (up to 256 characters). A retry of the same request within 24 hours returns the original response instead of sending again (idempotency). Key it to the discussion id (or to a specific approved-and-public event id you already store), not to the clock and not to the author’s email alone. If the same address later starts a different discussion that is also approved, that is a second notice and a second key.
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 (cc and bcc). A discussion-is-now-public notice addresses the author whose topic just became public. If a second contact also has to be told, add that address deliberately and accept that it counts as a second recipient. Do not cc every moderator or every tag watcher by default.
HTTP 200 from POST /emails means the message was accepted and queued. It is not a delivery receipt. The JSON is {"object":"email","id":"..."}. Persist that id next to the discussion record if you want to look the message up later from a dashboard session. Do not block the Flarum extender or queue worker until a mailbox provider confirms delivery.
scheduled_at is a documented ISO 8601 future timestamp if you ever need to hold a notice (scheduled email). For a discussion that is already public, send immediately after the public record is written. If you did schedule a message and the author should not receive it, POST /emails/:id/cancel cancels an unsent message. Reading, cancelling, and any rescheduling need full_access or a dashboard session. This article does not invent a reschedule request body. Attachments, when you have a genuine reason to include one, use { filename, content, content_type } with content as base64; a public-discussion notice rarely needs a file.
Errors you should handle in the Flarum extender
Documented send errors use an envelope of { statusCode, name, message }:
- 400 — a missing required field, a
fromdomain that does not belong to your organization, atemplatethat 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, malformed, or revoked Bearer key. Check the process environment, not the discussion row.
- 429 — you are being rate limited. Back off and retry with the same
Idempotency-Keyso a later attempt cannot send a second notice for the same public discussion (rate limits, retries).
Treat unknown 5xx responses as retryable with the same key. Log name and message next to the discussion id; do not log the Bearer key. A practical walk-through is the email API error handling guide. Related operational reading includes email API logs and email API integration.
Delivery is asynchronous — do not poll from the extender
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 Flarum extender or queue worker. 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. Related reading includes the email webhooks API and transactional email webhooks.
What not to do in this discussion-is-now-public notice
- Do not put the Rovela key in a browser client, a public repository, a Flarum frontend extension that ships to the browser, or a container image.
- Do not invent a Rovela Flarum plugin that approves discussions or changes visibility. Your extender already recorded the approval; Rovela delivers the mail. There is no official client library. Rovela is not changing topic status.
- Do not send this as an “your forum account was approved,” “someone mentioned you in a comment,” or “your directory listing is live” template borrowed from another tutorial. The permalink is a public discussion the author can now open, and the recipient is that author.
- Do not include identity documents, password material, or a dump of private moderator notes in the email body. The notice carries a short topic title and the permalink.
- Do not send from mailbox SMTP for this. SMTP is for mail apps and mailboxes. A Flarum extender or queued job should use the HTTP API. Inbound mail into a hosted mailbox is a different path, described in the webmail manual; this guide is an outbound discussion-is-now-public notice. If you are migrating an older mailer, see migrate SMTP to the Email API and SMTP ports 25, 465, and 587.
- Do not poll
GET /emails/:idwith asending_accesskey, and do not invent a reschedule body if you later cancel an unsent message.
A compact discussion-is-now-public checklist
- Verify the sending domain and create a
sending_accesskey (Quick Start). - Put
ROVELA_API_KEYandROVELA_FROMin the Flarum extender or queue worker’s process environment, not in a frontend script. - Record the public discussion first: the author’s address, a short topic title, and the topic permalink they already have.
- Call
POST /emailswith a PHP HTTP client (or curl), bothhtmlandtext, areply_toif you want replies in a community inbox, and anIdempotency-Keyscoped to that discussion id. - Treat HTTP 200 as accepted, not delivered. Persist the returned message id if you need it later.
- Confirm delivery with a signed webhook or from the dashboard.
- 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.