/redaxo-yform:yform-email-templatesfrom redaxo-yform
Guides creating and editing YForm email templates, using tpl2email actions, sending templates programmatically from PHP, and troubleshooting placeholder substitution.
Ships in redaxo-yform. 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.
YForm ships its own email-template system, separate from REDAXO's content. Templates live under YForm → Email Templates in the backend with a key, subject, plain-text body, optional HTML body, and From/Reply-To metadata. The recipient is not part of the template – it is set by the calling code (tpl2email or mail_to).
Inside a template body or subject, reference form fields with:
REX_YFORM_DATA[field="fieldname"]
For choice fields, two extra suffixes give you the human-readable labels instead of the stored values:
REX_YFORM_DATA[field="choice_field_LABELS"] -- choice labels as comma-separated text
REX_YFORM_DATA[field="choice_field_LIST"] -- choice labels with line breaks
Inline PHP also works inside templates:
<?php
if ('REX_YFORM_DATA[field="anrede"]' == 'w') {
echo "Frau";
} else {
echo "Herr";
}
?>
Substitution happens after placeholder replacement, so the literal 'REX_YFORM_DATA[...]' becomes the field value before PHP runs.
tpl2email)$yform->setActionField('tpl2email', [
'template_key', // backend template key
'email', // recipient: fixed address, or the name of a form field holding one
'', // recipient display name (literal text, not a field name)
]);
In pipe syntax:
action|tpl2email|template_key|recipient_address_or_field|[recipient_name]|[error_message_on_failure]
There is no sender parameter – From and Reply-To always come from the template. If the recipient slot is neither a valid address nor the name of a form field, the mail goes to rex::getErrorEmail() (legacy exception: an empty recipient slot followed by an address in the name slot sends to that address).
The action runs after validation passes. Multiple tpl2email actions per form are allowed (e.g. notify admin + send confirmation to user).
Use this when you need to send a YForm email template from a cronjob, a callback action, or anywhere outside the form lifecycle:
$tpl = rex_yform_email_template::getTemplate('template_key');
if (!$tpl) {
return; // template doesn't exist
}
$values = [
'vorname' => 'Max',
'nachname' => 'Mustermann',
'email' => '[email protected]',
];
foreach ($values as $key => $value) {
foreach (['body', 'body_html', 'subject'] as $part) {
$tpl[$part] = str_replace(
'REX_YFORM_DATA[field="' . $key . '"]',
$value,
$tpl[$part]
);
}
}
$tpl['mail_to'] = '[email protected]';
rex_yform_email_template::sendMail($tpl);
The $tpl array stays mutable up to sendMail() – set mail_from, mail_to, mail_cc, mail_bcc, mail_reply_to, attachments directly before sending.
When a form has an upload field, route the uploaded files into the template attachments:
$yform->setValueField('upload', ['attachment', 'Attachment']);
$yform->setValueField('php', ['php_attach', 'Attach',
'<?php if (isset($this->params["value_pool"]["files"])) {
$this->params["value_pool"]["email_attachments"] =
$this->params["value_pool"]["files"];
} ?>'
]);
$yform->setActionField('tpl2email', ['template_key', 'email']);
The php value field re-keys uploads into the email_attachments pool that tpl2email reads.
If the template uses an HTML body, every REX_YFORM_DATA[...] placeholder that contains user input is interpolated raw. Always wrap user-provided strings in HTML-escaping inside the template:
<p>From: <?= rex_escape('REX_YFORM_DATA[field="email"]') ?></p>
For plain-text bodies, escaping is unnecessary but newlines from textareas come through as-is — make sure the template doesn't accidentally HTML-render those.
Create one template per language with a _<clang_code> suffix (e.g. contact_form_de, contact_form_en). Pick the right one in PHP before sending:
$key = 'contact_form_' . rex_clang::getCurrent()->getCode();
$tpl = rex_yform_email_template::getTemplate($key)
?? rex_yform_email_template::getTemplate('contact_form_de'); // fallback
tpl2email that doesn't exist – the action silently fails. Verify the template key in the backend.mail_to from a user-controlled field without validating it as an email – open relay risk.body_html only without a plain-text body – Gmail and several corporate mail filters quarantine messages.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
yform, email-templates, tpl2email, rex-yform-data, placeholder-syntax
npx claudepluginhub friendsofredaxo/claude-marketplace --plugin redaxo-yform6 skills in this plugin
/yform-datasetsORM-style read/write on YForm tables using rex_yform_manager_dataset and the query builder (rex_yform_manager_query). Covers model classes, all where/join/select/order/group methods, relations, pagination via rex_pager, CRUD, dataset-driven forms, and SQL debugging. Use when the user reads or writes to a YForm table from PHP, builds custom backend lists, joins related tables, paginates, or queries datasets in frontend templates./yform-fieldsYForm field types, validators, and actions – the building blocks for forms and tables. Covers all value/validate/action types with parameters, the choice / be_manager_relation / upload field configurations, custom field types, and the pipe syntax used in the Formbuilder. Use when picking field types, configuring validators, building custom field/validator classes, troubleshooting field rendering or save behavior, writing forms in pipe syntax, or when the user says "Feldtypen", "YForm-Felder", "Validierung", "Formular-Felder", "be_manager_relation", or "Formbuilder Pipe-Syntax"./yform-frontendBuilding public-facing YForm forms in REDAXO – contact forms, registrations, surveys, edit forms loading existing records, file uploads with email attachments, spam protection (honeypot/timestamp), CSRF tokens, and the full objparams cheat sheet. Use when the user creates or edits a frontend form, configures email actions, builds an edit-existing-record form, troubleshoots form rendering on the frontend, or asks how to set form_action / form_anchor / form_showformafterupdate./yform-rest-apiYForm's built-in REST API – exposing YForm tables as JSON:API endpoints. Covers route registration via rex_yform_rest_route, GET filter/include/order/pagination params, JSON:API POST bodies, DELETE, token-based authentication, and CORS headers. Use when the user exposes a YForm table as a REST endpoint, configures token auth, customizes per-method field whitelists, builds a frontend SPA that calls a YForm-backed API, or says "REST-Endpoint", "JSON-API", "Token-Auth", "API-Aufrufe", "Endpunkt für YForm-Tabelle"./yform-tablesDefining and managing YForm tables in REDAXO – Table Manager backend UI, rex_yform_manager_table::ensure() in install.php, schema migrations, and tableset import/export. Use when the user works with YForm tables, edits install.php for a yform-using addon, defines field configurations, configures table-level options (pagination, search, history, export/import), or migrates table schemas between versions.Other plugins' skills for the same job