Send Gmail
Send mail from the connected Gmail mailbox based on a row – a fresh message, a reply, a forward, or a saved draft – storing the sent message’s Gmail id in a new column for later ingredients to use.
Ingredient Family: rowActionsIngredients
Outline Display: Send Gmail{{mode: in {{mode}} mode}} to {{to}} with subject {{subject}}, storing the sent message id in {{columnName}}.
Modes allowed: new{{allowReply:, reply}}{{allowForward:, forward}}{{allowDraftSend:, saved draft}}{{allowedRecipients:
Allowed recipients: {{allowedRecipients}}}}{{blockedBodyPatterns:
Blocked body patterns: {{blockedBodyPatterns}}}} The content is:
{{body}}
Details
mode picks what is sent: new (the default) is a fresh message from to/subject/body; reply answers the message named by messageId, landing in its thread behind one Re: prefix and proper In-Reply-To/References headers, addressed to the original’s Reply-To (else From) when the recipient formula produces no address; forward sends the original along as an attachment, fetched in Gmail’s raw form and never decoded, with the body as an optional comment above it. A draftId formula producing a non-empty id instead sends that existing draft: every compose setting is ignored, and what is re-checked at send time is the draft’s stored recipients, since a person may have edited them – each must be one plain address and must match allowedRecipients, and a draft naming nobody fails the step. The body is not re-scanned against blockedBodyPatterns, because sending a draft never fetches it.
The mail is sent as the Google connection’s authenticated identity, and no From header is written, so the sender is not configurable. Recipient formulas produce comma-separated lists of bare addresses; display-name forms like Dan <dan@x.com> are refused. A recipient or subject containing a line break or other control character fails the step rather than being cleaned up, since it could otherwise inject headers into the assembled message. allowedRecipients is checked against every address across to, cc and bcc, a reply’s derived original-sender address and a draft’s stored recipients included, and one address that misses fails the step and names it. The body is sent as plain text; there is no HTML variant.
allowReply, allowForward and allowDraftSend decide which of those modes may run at all: a mode that is off fails the step when the mode formula (or a non-empty draft id) names it. The scopes asked for follow them – gmail.send always, gmail.readonly only for reply and forward, which read the original first, and gmail.compose only for draft sends – so a send-only configuration carries gmail.send alone.
On success the new column carries the sent message’s Gmail id (in every mode, a sent draft included), so a later Call API endpoint ingredient can act on that very message – apply a label, archive it, and so on. On any failure the step fails the action and nothing later in the pipeline runs.
Local scope
The parent slot binds these (look up the slot in the parent to see how):
$table– The table to act on
Settings
Required
-
Gmail: API connection (API category:Google; scopes:https://www.googleapis.com/auth/gmail.send,https://www.googleapis.com/auth/gmail.readonly(whenallowReply),https://www.googleapis.com/auth/gmail.readonly(whenallowForward),https://www.googleapis.com/auth/gmail.compose(whenallowDraftSend))
The Google connection used to send Gmail (and to read originals for reply and forward)
Set this to thenameof anapi:item whoseprovider:is in theGooglecategory, or which reachesGoogleon another category’s behalf – a brokered api counts when its own settings point it at that service, and its provider page says which setting decides. Do not set it to a service name; pick the API the service points at. -
to: formula (returns text; required, non-nullable)
A formula that generates the recipient addresses, as a comma-separated list of bare addresses; in reply mode, leave it producing the empty string to answer the original’s sender
Scope: all columns of$table(reference as[ColumnName], e.g.,[Name],[Price]) -
subject: formula (returns text; required, non-nullable)
A formula that generates the email subject line
Scope: all columns of$table(reference as[ColumnName], e.g.,[Name],[Price]) -
body: formula (returns text; required, non-nullable)
A formula that produces the plain-text email body
Scope: all columns of$table(reference as[ColumnName], e.g.,[Name],[Price]) -
columnName: new column (type: text; required, non-nullable)
The name of the new column holding the sent message’s Gmail id (must not shadow other names).
Optional
-
allowReply: constant value (type: bool; required, non-nullable)
Allow thereplymode, which reads the message being answered to thread and address the reply. Off by default, so the step carries only the scopes its enabled modes need; setting it true adds the gmail.readonly grant that read requires, and while it is off a mode formula producingreplyfails the step. -
allowForward: constant value (type: bool; required, non-nullable)
Allow theforwardmode, which reads the original message in raw form to carry it along as an attachment. Off by default; setting it true adds the gmail.readonly grant that read requires, and while it is off a mode formula producingforwardfails the step. -
allowDraftSend: constant value (type: bool; required, non-nullable)
Allow sending an existing draft named by thedraftIdformula, which reads the draft’s stored recipients before sending. Off by default; setting it true adds the gmail.compose grant that read requires, and while it is off a non-empty draft id fails the step. -
mode: formula (returns text; required, non-nullable)
A formula choosing what is sent:new(the default, and what an empty value means) composes a fresh message,replyanswers the message named bymessageIdin its thread,forwardsends that original along as an attachment. Ignored whendraftIdproduces a non-empty id. Pin a literal mode or feed one in from a tool parameter.
Scope: all columns of$table(reference as[ColumnName], e.g.,[Name],[Price]) -
cc: formula (returns text; required, non-nullable)
A formula that generates the Cc addresses, comma-separated; leave empty for none
Scope: all columns of$table(reference as[ColumnName], e.g.,[Name],[Price]) -
bcc: formula (returns text; required, non-nullable)
A formula that generates the Bcc addresses, comma-separated; leave empty for none
Scope: all columns of$table(reference as[ColumnName], e.g.,[Name],[Price]) -
messageId: formula (returns text; required, non-nullable)
A formula producing the Gmail id of the original message being replied to or forwarded; required by the reply and forward modes, ignored otherwise
Scope: all columns of$table(reference as[ColumnName], e.g.,[Name],[Price]) -
draftId: formula (returns text; required, non-nullable)
A formula producing the id of a saved draft to send instead of composing: a non-empty id sends that draft as stored – its recipients are re-checked againstallowedRecipients– and every compose setting is ignored
Scope: all columns of$table(reference as[ColumnName], e.g.,[Name],[Price]) -
allowedRecipients: constant value (type: text; optional)
Regex pattern restricting which email addresses may be sent to (e.g. ‘.*@company.com$’). Checked against every address across to, cc and bcc, a reply’s derived original sender and a draft’s stored recipients included; a single address that does not match fails the step. Leave blank to allow any recipient. -
blockedBodyPatterns: constant value (type: text; optional)
Regex matched against the outbound subject and body; if it matches, the step fails and nothing is sent. Combine multiple secret/PII patterns with regex alternation.