update_draft
Update an existing email draft by replacing fields like recipients, subject, body, and attachments. Preserves threading headers while recreating the draft with a new ID.
Instructions
Update an existing draft. Implemented as delete-and-recreate.
Returns a NEW draft_id — Mail.app forbids mutating saved drafts, so update is implemented by reading the draft's current state, deleting it, and creating a new draft with the merged fields. Threading headers (for reply seeds) and forward anchor are preserved via persisted seed metadata.
Field merge semantics: any non-None argument overrides the existing
value. None keeps the existing value. attachment_paths=None
PRESERVES existing attachments (extracted via Mail's save
command); [] explicitly clears them; a list replaces.
For drafts created externally (not via create_draft), seed
recovery falls back to scanning Mail.app for the In-Reply-To header
— this can be slow on large mailboxes (~30s+ per call). Forward
seeds without disk state are misclassified as fresh; pass an
explicit body if so.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cc | No | ||
| to | No | ||
| bcc | No | ||
| body | No | Override body. None keeps existing. Non-None replaces (including the empty string, which clears). | |
| subject | No | Override subject. None keeps existing. | |
| draft_id | Yes | Mail.app id of the existing draft. | |
| send_now | No | ``False`` (default) saves new draft. ``True`` sends after eliciting confirmation. | |
| body_html | No | Optional HTML body for the recreated draft (see ``create_draft``). Requires IMAP credentials and is limited to drafts whose seed is a fresh draft (not reply/forward) and to ``send_now=False``. NOTE: because the draft is recreated and draft state captures only plain text, an existing HTML draft is NOT preserved across an update unless ``body_html`` is passed again. (#251) | |
| from_account | No | Override sender. | |
| template_name | No | ||
| template_vars | No | ||
| attachment_paths | No | Override attachments. None preserves existing via temp-dir extraction; [] clears; list replaces. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||