← Back to blog

HTML Email API (2026): Send HTML and Plain Text Together with Rovela

How to send HTML email with Rovela’s API: html plus text in POST /emails, when to use template { id, variables } instead, and why batch rejects templates.

Updated November 10, 2026
HTML Email API (2026): Send HTML and Plain Text Together with Rovela

An HTML email API is still just JSON

An HTML email API is how you send a styled message body without assembling MIME on the client. On Rovela you put an html string — and, whenever you can, a matching text string — in the JSON body of POST /emails. The service builds the MIME multipart and DKIM-signs it like any other message.

The Send Email API is explicit: html is the HTML body, text is the plain-text body, and you should send both where you can. Many mail clients show the text part in the notification preview, which is exactly where people read a verification code. At least one of html, text, or template is required.

This is not a CSS or template-authoring tutorial. For layout consistency, see HTML Email Template Development. For stored templates and variables, see Email Templates API Guide and the templates guide. For a welcome-mail recipe, see Welcome Email from a Template.

Start from the Email API product page, the Quick Start, the Send Email API, and Authentication.

Related product guides in this series:

Send HTML and text in one request

curl -X POST https://api.rovela.dev/emails \
  -H "Authorization: Bearer re_your_sending_key" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: receipt-order-1042" \
  -d '{
    "from": "Acme <receipts@mail.acme.com>",
    "to": "alice@example.com",
    "subject": "Your Acme receipt for order 1042",
    "html": "<p>Thanks for your order.</p><p>Order <b>1042</b> — total <b>$42.00</b>.</p>",
    "text": "Thanks for your order. Order 1042 — total $42.00.",
    "tags": { "kind": "receipt", "orderId": "1042" }
  }'

from must be on a verified domain. Prefer a sending_access key in production, and an Idempotency-Key whenever the caller might retry (Email API Authentication, Email API Retries).

A receipt or a code should put the essentials in both parts: the total or the code in the HTML, and the same facts in text. If a client strips HTML, the message is still readable; if a notification preview only shows text, the person still sees the number.

When to use a stored template instead

template is an object { id, variables } and is mutually exclusive with html and text. Use it when the layout should live in Rovela — edited in the dashboard with {first_name}-style variables — and your application should only pass data (Templates API, Templates guide).

Do not send html and template together in the hope that one fills in the other; the API treats them as alternatives. Subject may be omitted when the template supplies one. Batch sending is the other constraint: POST /emails/batch rejects template (and topic_id) rather than ignoring them. Template-based mail goes through POST /emails (Batch Transactional Email API).

What this API will not do for you

  • It will not automatically generate a text part from your HTML. If you omit text, some previews will be empty or will show markup. Supply both.
  • It is not a full inlining or spam-scoring studio. Write conservative HTML (tables, inline CSS) in your own pipeline or in the template editor if you need that; then send the resulting string.
  • Attachments are a separate array (filename, base64 content, content_type), not something you embed as a data URI in place of a real PDF. See Email Attachments Guide and Receipt Email API.
  • Open and click tracking can be enabled per domain (PATCH /domains/:id includes whether tracking is enabled for mail sent from that domain). The product also documents tracking in the dashboard and in webhooks. Details: Email Open and Click Tracking.

A few body habits that survive real clients

  • Keep the important sentence — the code, the amount, the reset instruction — near the top, in both html and text.
  • Use a reply_to that a person can actually answer, while from stays on the verified sending domain (Invoice attachment example).
  • Do not put secrets only in an image or a styled button; repeat them in text.
  • Test with the address you actually use on a phone, then confirm delivery with GET /emails/:id/events or the dashboard (Email Delivery Status API).

FAQ

Can I send HTML only? Yes, the API allows html without text, but the docs recommend both. For codes and receipts, skipping text is how previews become useless.

Can I use Markdown? The API fields are html and text. If you write Markdown, render it to HTML on your server first, and still provide a plain-text part.

Where do template variables go if I am not sending raw HTML? In template.variables on POST /emails, as documented by the Templates API — not as {{name}} leftovers inside an html field you also send.

Send both parts, or store one template

For one-off transactional HTML, post html and text together and move on. When the same layout is reused, store a template and stop shipping markup in the application. Either way, the request is still one JSON POST to Rovela.