MailerPreviewEmail¶
POST mailer/email/preview
Assembles the message without sending anything: the subject, the final HTML, the generated text part, the headers, the size in bytes, and which placeholders stayed unresolved.
This is the method behind the template editor. It runs the same assembly path as sending, so what the editor shows is what the recipient would get.
Access Control¶
Allowed roles: admin, leader, manager.
Request¶
POST https://{broker_domain}/mailer/email/preview
{
"templateId": 4,
"data": {
"name": "John",
"amount": "250 EUR"
},
"to": "[email protected]"
}
{
"command": "MailerPreviewEmail",
"extID": "1",
"data": {
"templateId": 4,
"data": {
"name": "John",
"amount": "250 EUR"
},
"to": "[email protected]"
}
}
const res = await platform.MailerPreviewEmail({
templateId: 4,
data: {
name: "John",
amount: "250 EUR"
},
to: "[email protected]"
});
Request Data¶
| Field | Type | Required | Description |
|---|---|---|---|
templateId |
int | No | Template to render; use it instead of passing content |
subject |
string | No | Subject, up to 512 characters |
html |
string | No | HTML body |
text |
string | No | Plain-text part; generated from the HTML when omitted |
structure |
array | No | Email builder tree; the HTML is rendered from it |
data |
object | No | Placeholder values |
to |
string | No | Recipient, to render the unsubscribe link |
kind |
enum | No | TRANSACTIONAL or MARKETING |
Behavior¶
- Without
toa marketing preview cannot build a real unsubscribe link — the response says so withunsubscribePending: trueinstead of failing. bytesis what decides whether Gmail will clip the email; see MailerLintEmail for the full pre-send check.
Response Data¶
{
"subject": "John, your deposit of 250 EUR is confirmed",
"html": "<!doctype html><html>…</html>",
"text": "John, your deposit of 250 EUR is confirmed",
"kind": "MARKETING",
"headers": {
"List-Unsubscribe": "<https://brand.example/unsubscribe?token=…>",
"List-Unsubscribe-Post": "List-Unsubscribe=One-Click"
},
"unsubscribePending": false,
"bytes": 18422,
"placeholders": ["name", "amount"],
"missingPlaceholders": [],
"templateId": 4
}
Errors¶
| Code | Error | Description |
|---|---|---|
400 |
VALIDATION_ERROR |
No content and no template |
404 |
TEMPLATE_NOT_FOUND |
Template not found in the brand |