Gmail — Send
Gmail — Send
Section titled “Gmail — Send”Type: gmail-send · Package: Gmail v1.0.4 · Output: string
Sends a new email from the session’s account. It supports several recipients, Cc and Bcc, a plain-text or HTML body and file attachments. It shows up in Sent, just as if you had sent it from Gmail.
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.
- Recipients: in
to,ccorbccwrite the addresses separated by commas or semicolons ("ana@example.com; luis@example.com"), or pass a list of addresses, for example a variable built in the flow (recipients). The named format (Ana Perez <ana@example.com>) also works. - Sender: always the session mailbox’s address.
- Body: if you turn on
isHtml,bodyis sent as HTML; otherwise as plain text. - Attachments: one path or a list of paths; each file must exist on the machine where the robot runs and is attached with its own name. If one is missing, nothing is sent. Unlike recipients, a text with several comma-separated paths is not split: for several files use a list.
Gmail accepts messages of up to 25 MB, attachments included. For larger files, share them through Google Drive and send the link.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
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. |
subject | string | "" | Email subject. |
body | string | "" | Email body (plain text or HTML). |
isHtml | bool | false | If true, the body is interpreted as HTML. |
attachments | string | List | — | Path of one file, or a list of paths, to attach. |
Output
Section titled “Output”Returns a string with the sent message ID. It works as the id of the other activities, for example to label it with Apply label. If you don’t need it, you can ignore it.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
'to' is required. | to is empty or the list has no addresses. |
Attachment file not found. | A path in attachments does not exist on the robot’s machine. Check it with File Exists before sending. |
ParseException error while reading an address | An address in to, cc or bcc is malformed. |
Request had insufficient authentication scopes. | The connection lacks permission to send email. Check its scopes in Zoan Cloud. |
Example
Section titled “Example”Gmail — Connect credential = credential("gmail-reports") └─ body: Excel to PDF path = "C:\reports\sales.xlsx" → output: pdf Gmail — Send to = "management@example.com; finance@example.com" cc = "audit@example.com" subject = "Sales report" body = "<p>Please find today's report attached.</p>" isHtml = true attachments = pdf → output: sentId Gmail — Apply label id = sentId labels = "Reports"Related activities
Section titled “Related activities”- Gmail — Connect — open the session.
- Gmail — Reply — reply within an existing thread.
- Gmail — Get emails — search emails.
- All Gmail activities