/htmx-php-builder:malumail-sendfrom htmx-php-builder
Sends transactional email via the MaluMail REST API. Handles sending, suppression list management, and debugging auth/rate-limit failures.
Ships in htmx-php-builder. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Send transactional email over a small REST API. This is the live contract at
api.malumail.com — every field, status code, and behavior below matches the
running service. Do not invent fields or endpoints beyond what is listed here.
https://api.malumail.com (HTTPS only; non-HTTPS → 400)Authorization: Bearer <api-key> on every requestfrom an address whose domain
is verified on the account (ownership TXT + SPF include:_spf.malumail.com +
DKIM published). Unverified from domain → 403. DKIM/SPF are then applied
automatically; you never sign anything.mm_ + 48 lowercase hex chars (regex ^mm_[a-f0-9]{48}$). Store as a
secret; never commit it. Revoking in the portal makes it 401 immediately.POST /v1/sendRequest JSON:
| Field | Type | Required | Notes |
|---|---|---|---|
from | string | yes | Valid email; its domain must be a verified sending domain (else 403). |
from_name | string | no | Display name → "Name" <from>. |
to | string | string[] | yes | 1–50 addresses. All go in one shared message (recipients see each other). |
subject | string | yes | Non-empty. |
text | string | one of | Plain-text body. |
html | string | one of | HTML body. |
At least one of text/html is required. Both → multipart/alternative.
Server auto-generates Date, Message-ID, MIME-Version.
Success 200:
{"status":"sent","accepted":["[email protected]"],
"rejected":[{"email":"[email protected]","reason":"suppressed:bounce"},
{"email":"bad","reason":"invalid_address"}]}
200 — always inspect rejected.rejected reasons: invalid_address, or suppressed:<reason> (never delivered).400 {"error":"No deliverable recipients.","rejected":[...]}.Example:
curl -sS -X POST https://api.malumail.com/v1/send \
-H "Authorization: Bearer $MALUMAIL_API_KEY" \
-H "Content-Type: application/json" \
-d '{"from":"[email protected]","from_name":"Your App",
"to":"[email protected]","subject":"Welcome",
"text":"Thanks for signing up.","html":"<p>Thanks for signing up.</p>"}'
PHP (the plugin-standard helper — app/mail.php, loaded by bootstrap.php, per php-patterns):
<?php
declare(strict_types=1);
/**
* Send one email via MaluMail. Returns the decoded API response.
* Throws RuntimeException on transport errors and non-2xx responses.
*/
function malumail_send(array $mail): array
{
$ch = curl_init('https://api.malumail.com/v1/send');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('MALUMAIL_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode($mail, JSON_THROW_ON_ERROR),
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
$errno = curl_errno($ch);
curl_close($ch);
if ($errno !== 0 || $body === false) {
throw new RuntimeException('MaluMail transport error.');
}
$decoded = json_decode((string) $body, true);
if ($status !== 200) {
// 429/502: caller may retry with backoff. 4xx: fix the request. Never log the key.
throw new RuntimeException("MaluMail send failed ({$status}): " . ($decoded['error'] ?? 'unknown'));
}
return $decoded; // inspect $decoded['rejected']
}
$result = malumail_send([
'from' => '[email protected]',
'from_name' => 'Your App',
'to' => $user['email'],
'subject' => 'Reset your password',
'html' => $html,
'text' => $text,
]);
log_activity(db(), 'email', null, 'sent', ['to' => $user['email'], 'rejected' => $result['rejected']]);
Python:
import os, requests
r = requests.post("https://api.malumail.com/v1/send",
headers={"Authorization": f"Bearer {os.environ['MALUMAIL_API_KEY']}"},
json={"from":"[email protected]","to":"[email protected]",
"subject":"Welcome","html":"<p>Thanks!</p>"}, timeout=30)
r.raise_for_status()
for rej in r.json()["rejected"]:
... # suppressed/invalid recipients
/v1/send silently refuses suppressed addresses (they appear in rejected).
Bounces/complaints are auto-suppressed by the platform. Manage the list:
GET /v1/suppressions[?search=<substr>] → {"suppressions":[{email,reason,created_at,is_global}]} (your entries + global, ≤1000).POST /v1/suppressions {"email":..,"reason":"manual"|"unsubscribe"} → 201; 409 if already present.DELETE /v1/suppressions?email=<addr> → 200; 404 if none. Global entries cannot be deleted via API.| Code | Meaning | Retry? |
|---|---|---|
| 200 | Sent (check rejected) | — |
| 201 | Suppression created | — |
| 400 | Validation / bad JSON / all recipients undeliverable | no — fix request |
| 401 | Missing/malformed/invalid key or inactive account | no |
| 403 | from domain not verified on this account | no — verify domain |
| 404 | Unknown endpoint / no such suppression | no |
| 409 | Already suppressed | no |
| 429 | Rate limit (N/hour, M/day) | yes — back off |
| 500 | Key has no relay credential (recreate key) | no |
| 502 | Mail relay refused (SMTP error included) | yes — backoff |
Error bodies are {"error":"<message>"} (the all-rejected 400 also has rejected).
to of 10 = 10 units); over limit → 429, message not sent.No attachments/inline images, no cc/bcc/Reply-To/custom headers, no
templates or merge variables, no scheduling, no open/click tracking, no
List-Unsubscribe header, no delivery webhooks. Bodies are text/html only.
For bulk or individualized mail, send one request per recipient (avoids
recipients seeing each other and enables per-recipient bodies); honor 429
backoff. The ≤50 to array is only for a genuinely shared message.
from a verified domain; store the key as a secret.200, inspect rejected: treat suppressed:* as permanent (don't retry
those recipients); invalid_address is a data-quality issue.429/502/transient 5xx with exponential backoff. There is
no idempotency key — never retry a request that already returned 200
(it would double-send). Retry only when you did not receive 200.POST /v1/suppressions.malumail_send().MALUMAIL_API_KEY lives in environment config alongside DB_* — never in
code, the database, or the browser.view() helper (app/views/emails/*.php),
escaped with e() — one template per message type, text and HTML variants.POST /v1/suppressions with
reason: "unsubscribe" (a dedicated full page, per the design system).Verified against the live service. Source of truth: the /v1/send handler in
html/mailapi/index.php on the web app — reconcile this file with it if the API grows.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub maludb/maludb-os-htmx-php-guidelines --plugin htmx-php-builder10 skills in this plugin
/chat-actionsThe voice-first chat command bar that ships on every screen of every application — natural language in (typically dictated via a tool like Wispr Flow), application actions and navigation out, powered by an LLM router activating MCP tools. Use when building or extending the assistant command bar, the actions MCP server, the action manifest, chat-driven navigation, or voice-to-data capture./design-systemThe mandatory UI design system for applications built with this plugin — Bootstrap 5.3 admin template (nxl theme) with fixed layout, component patterns, and mobile-first rules. Use before generating or editing ANY page, screen, partial, or HTML in an application built with this plugin, and when the user mentions look and feel, styling, layout, or UI consistency./mcp-serversDesign and build the two MCP servers every application ships — the record-memory server over PostgreSQL 17 and the activity-memory server over MaluDB — in Python with FastMCP, exposed to the app's AMA agent and to clients' own AI tools. Use during Phase 1 (tool-surface design) and when implementing, deploying, or extending an application's MCP servers./memory-first-planningBackground context for planning or brainstorming a new application or SaaS product — memory-first design, the ask-me-anything view of applications, SaaS Plus+ data sovereignty, and the default technical stack (PostgreSQL 17 + MaluDB, Apache/PHP/Bootstrap 5.3/HTMX). Provides answers and direction, not a workflow to run./new-appStart building a new HTMX + PHP + Bootstrap 5.3 application. Use when the user says "new app", "start a new application", "build an app", "begin the project", or invokes /new-app. Enforces the fixed build order — full database + memory design first, then authentication + app shell, then vertical feature slices — on the standard stack (Ubuntu 24.04, PostgreSQL 17 + MaluDB, Apache, PHP, HTMX)./new-screenGenerate a new screen (list, detail, create/edit form, report, or settings page) in an HTMX + PHP + Bootstrap 5.3 application built with this plugin. Use when the user asks to "add a screen", "create the customers page", "build the edit form", or invokes /new-screen. Guarantees every screen matches the design system and mobile rules.Other plugins' skills for the same job