Skip to content

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.

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, cc or bcc write 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, body is 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.

ParameterTypeDefaultDescription
tostring | List—Recipient(s): text with addresses separated by commas or semicolons, or a list of addresses.
ParameterTypeDefaultDescription
sessionZoanGmailSession—Gmail — Connect session (inherited inside body).
ccstring | List—Cc recipient(s): text separated by commas or semicolons, or a list.
bccstring | List—Bcc recipient(s): text separated by commas or semicolons, or a list.
subjectstring""Email subject.
bodystring""Email body (plain text or HTML).
isHtmlboolfalseIf true, the body is interpreted as HTML.
attachmentsstring | List—Path of one file, or a list of paths, to attach.

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.

MessageCause 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 addressAn 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.
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"