30 days free. No credit card. Full access from the moment you connect your site.

Start free trial

Update Contact Form Mail Template

contact-form-7/update-mail merges. Fields you omit keep their current values, which is the difference between this and passing a mail object to contact-form-7/update-form — that one replaces the whole template.

So changing a subject line is one field, and the recipient, sender, body and headers stay exactly as they were.

At a glance

Abilitycontact-form-7/update-mail
ToolsetContact Form 7 — toolset/contact-form-7
GroupContact Form 7 › Mail & Notifications
RequiresContact Form 7, active on the site
Capabilitymanage_options, plus edit_contact_forms
SafetyWrites data
RepeatableIdempotent — running it twice leaves the same result
Ships inAcrossAI Abilities Manager 0.0.34 and later

The gate on this one

Changing recipient requires confirm: true. That one field decides where every submission on this form is delivered, and getting it wrong fails in the worst possible way: mail goes nowhere, nothing is logged, and the visitor still sees the success message. Every other field on this ability writes without a gate.

How it works

Run contact-form-7/list-mail-tags before writing a body. It returns the tags this form actually provides — one per named field, plus Contact Form 7’s built-in context tags — so the body does not reference something that does not exist.

A tag that matches nothing is not an error. It renders as empty, which is why the response returns unresolved_tags explicitly: it is the only place that breakage surfaces.

Some fields are sanitised before they are stored — headers in particular. The response lists which under sanitised, so you can read the stored mail back and see what survived rather than assuming your input went in verbatim.

Input

NameTypeRequiredWhat it is
form_idintegerYesForm post ID, as returned by contact-form-7/list-forms.
whichstringNo — defaults to mailmail is the notification sent to the site; mail_2 is the optional autoresponder sent to the visitor.
subjectstringNoMail subject. May contain mail tags.
senderstringNoFrom address.
recipientstringNoWhere submissions are delivered. Changing this requires confirm: true.
bodystringNoMail body. May contain mail tags.
additional_headersstringNoExtra headers, e.g. Reply-To: [your-email].
use_htmlbooleanNoSend as HTML rather than plain text.
exclude_blankbooleanNoDrop lines whose tags resolve to nothing.
confirmbooleanOnly when changing the recipientRequired when recipient is being changed. Ignored otherwise.

What comes back

NameTypeWhat it is
form_idintegerThe form that was written.
whichstringWhich template was written.
mailobjectThe mail template after the merge.
updatedarrayWhich fields actually changed.
unresolved_tagsarrayTags in the new content that match no field on this form.
sanitisedarrayFields whose content was altered by sanitising before storage.
successbooleanWhether the call completed.
messagestringA one-line summary of what happened, suitable for showing a human.
error_codestringPresent only on failure — a stable machine-readable reason, such as a missing field, a wrong field type or an unmet confirmation.

Example

Ask your assistant:

On form 42, add the phone number to the notification body and set a Reply-To header.

It resolves to one call:

{
  "ability": "contact-form-7/update-mail",
  "parameters": {
    "form_id": 42,
    "which": "mail",
    "body": "From: [your-name] <[your-email]>\nPhone: [your-phone]\n\n[your-message]",
    "additional_headers": "Reply-To: [your-email]"
  }
}

Worth knowing

  • Idempotent — sending the same fields twice leaves the same template.
  • Check unresolved_tags on every response. A tag matching nothing renders as empty rather than failing.
  • Check sanitised too, then read the stored mail back to see what was kept.
  • For the autoresponder, pass which: "mail_2" — and switch it on separately with contact-form-7/toggle-mail-2.

Related abilities


Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager

Browse the rest: Every ability, by category


Keep reading