Gmail — Forward
Gmail — Forward
Section titled “Gmail — Forward”Type: gmail-forward · Package: Gmail v1.0.4 · Output: string
Forwards an existing email to other people, like Gmail’s Forward button: it includes the original message with its details (sender, date, subject, recipients) and, by default, its attachments. You can add a comment on top and attach extra files.
It is the way to route an email to the right team: an invoice to accounting, a complaint to customer service, a request to the person who approves it.
How it works
Section titled “How it works”It works on the session created with Gmail — Connect. Pass it in the session parameter, or place this activity inside the body of Gmail — Connect to inherit it automatically.
- Fetches the email given in
id(from Get emails) in full, with its attachments. - Builds the forward: your comment (
body), then a---------- Forwarded message ---------block with the original’s details (From, Date, Subject, To) and its content. The subject gets theFwd:prefix (not repeated if already there). - If the original has HTML or you turn on
isHtml, the forward is HTML; otherwise plain text. When it is HTML withisHtml = false, your comment is treated as text: it is escaped and its line breaks are kept. - Adds the original attachments (unless you turn off
includeAttachments) and those inattachments. - Sends it from the session’s account, in the same thread as the original email, and returns the sent message’s ID.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
id | string | — | ID of the email to forward. |
to | string | List | — | Recipient(s): text with addresses separated by commas or semicolons, or a list of addresses. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanGmailSession | — | Gmail — Connect session (inherited inside body). |
cc | string | List | — | Cc recipient(s): text separated by commas or semicolons, or a list. |
bcc | string | List | — | Bcc recipient(s): text separated by commas or semicolons, or a list. |
body | string | "" | Comment placed above the forwarded message. |
isHtml | bool | false | If true, the comment is interpreted as HTML. |
includeAttachments | bool | true | If true, forwards the original attachments. |
attachments | string | List | — | Path of one file, or a list of paths, to attach in addition to the original ones. |
Output
Section titled “Output”Returns a string with the forwarded message’s ID. Assign it to a variable if you need it later; otherwise you can ignore it.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
'id' is required. | id is empty or the expression returned null. |
'to' is required. | No recipient was given, or the list is empty. |
Attachment file not found. | A path in attachments does not exist on the machine where the robot runs. |
Requested entity was not found. | No email with that ID exists in the mailbox. |
Example
Section titled “Example”Route emails with invoices to accounting and archive them:
Gmail — Connect credential = credential("gmail-frontdesk") └─ body: Gmail — Get emails query = "in:inbox subject:invoice has:attachment" → output: invoices For each email in invoices └─ Gmail — Forward id = email["id"] to = "accounting@example.com" body = "Invoice received for recording." Gmail — Archive id = email["id"]Forward without the original attachments, but with a file of your own:
Gmail — Forward id = email["id"] to = "management@example.com" cc = "audit@example.com" includeAttachments = false attachments = summaryPathRelated activities
Section titled “Related activities”- Gmail — Reply — reply to the sender instead of forwarding.
- Gmail — Send — send a new email.
- Gmail — Archive — take the email out of the inbox after forwarding.
- All Gmail activities