Update draft
update_draftReplace an existing draft's entire content: recipients, subject, and body. Provide complete new values; omitted fields are dropped.
Instructions
Replaces the whole message of a draft this deployment holds, and SENDS NOTHING. The draft keeps its identifier, its version count goes up by one, and the owner's Drafts folder ends up showing one message rather than one per edit. It states the WHOLE message rather than the part that changed: a recipient you leave out is no longer addressed, a body you do not restate is gone, and htmlBody you omit is dropped. Read the draft you are editing back from what you wrote and send it all again, or you will silently drop what you did not repeat. The shape is save_draft's and the same rule applies: name account and subject for a message of its own, or name answeredEmailId and answering for an answer and neither of the other two. An answer is re-derived from the stored email every time it is edited, which is what keeps an edited reply a reply — so the email being answered has to be named again, and naming a different one turns the draft into an answer to that message instead. Only a draft this deployment created can be updated, named by the draftId save_draft answered. A draft the owner wrote in their own mail client is not one of them, and neither is a draft that has already been sent with send_draft: both are refused as a draft this deployment does not hold, and what stops a message that was already sent is cancel_outgoing_email.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cc | No | The addresses the new version copies, each a plain mail address. It replaces the previous cc rather than adding to it. | |
| to | No | The addresses the new version is addressed to, each a plain mail address. This replaces whoever the draft addressed rather than adding to them, so omitting it leaves the draft addressed to nobody. On an answer these are the people you are adding beside whoever the answer already reaches. | |
| bcc | No | The addresses the new version blind-copies. It replaces the previous bcc rather than adding to it. | |
| account | No | The account the draft belongs to, named as list_accounts returned it. Required for a message of its own, and refused on an answer. It has to be the account that already holds the draft: naming another one is refused as a draft this deployment does not hold, so editing is never a way to move a message into a different mailbox. | |
| draftId | Yes | The draftId save_draft returned for the draft you are replacing. A UUID that does not change when the draft is edited. | |
| subject | No | The subject line the new version carries. Required for a message of its own, and refused on an answer, where it is derived from the email being answered. | |
| htmlBody | No | An HTML alternative to plainTextBody. Omitting it drops the HTML the draft had, leaving the plain text alone. | |
| answering | No | Which answer this draft is, required whenever answeredEmailId is named and refused otherwise. Changing it changes who the answer would reach. | |
| plainTextBody | Yes | The message body as plain text, which every draft carries, and which replaces the body the draft had. It is required even when you also write htmlBody. On an answer it is placed above the quoted original, which is added for you again — do not paste or paraphrase the message being answered. | |
| answeredEmailId | No | The storedEmailId of the email this draft answers, required whenever the draft is an answer. Name it together with answering, and name neither to write a message of its own. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| state | Yes | Whether the owner's own drafts folder shows this version of the draft yet. The draft is held here either way and can be sent either way. | |
| draftId | Yes | The stable identifier of the draft. It is what update_draft, delete_draft, and send_draft name it by, and it does not change when the draft is edited. | |
| savedAt | Yes | When this version of the draft was written down, as an ISO 8601 timestamp. | |
| revision | Yes | Which version of the draft this is, counted from one. Every accepted update_draft call adds one, and the folder ends up showing one message rather than a version apiece. | |
| accountId | Yes | The configured MailFathom account identifier the draft belongs to, and the one it would be sent as. Its Delivery configuration decides the From address, which a caller never supplies. | |
| recipientCount | Yes | How many people the draft is addressed to across its to, cc, and bcc headers, after addresses named twice were reduced to one. Nobody is named. A draft addressed to nobody is an ordinary draft that send_draft refuses until it is addressed. |