Gmail — Get email by ID
Gmail — Get email by ID
Section titled “Gmail — Get email by ID”Type: gmail-get-email · Package: Gmail v1.0.4 · Output: Dictionary<string,object>
Gets a full email by its ID: body (text and HTML), headers (sender, recipients, subject, date) and attachment info. Use it when Get emails gave you the list without bodies and you now need the content of a specific one.
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.
The id is the one in each item returned by Get emails (id key) or the one returned by Send, Reply and Forward. It only reads: it does not mark the email as read.
The body is built by walking the message parts: it takes the first plain-text part and the first HTML part. If the email only has HTML, body holds that HTML with the tags stripped, handy for text searches or for passing to AI Extract.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
id | string | — | Message ID (from Get emails). |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanGmailSession | — | Gmail — Connect session (inherited inside body). |
Output
Section titled “Output”Returns a Dictionary<string,object> with the same keys as each item of Get emails with includeBody turned on:
| Key | Type | Content |
|---|---|---|
id, threadId | string | Message ID and its conversation ID. |
from, to, cc, subject, date | string | Headers as is (cc is null if none). |
snippet | string | Excerpt from the beginning of the message. |
labels | List<string> | IDs of the email’s labels. |
unread | bool | true if unread. |
body | string | Plain text; if there is only HTML, the HTML with tags stripped; "" if there is no body. |
bodyHtml | string | HTML body, or null. |
attachments | List<Dictionary> | One item per attachment: filename, mimeType, size (bytes), attachmentId. Empty list if none. |
The attachments list describes the attachments but does not download them; to save them use Download attachments.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
'id' is required. | id is empty or the expression returned null. |
Requested entity was not found. | No email with that ID exists in the mailbox (deleted, or the ID belongs to another mailbox). |
No Gmail session available. … | You didn’t pass session and the activity is not inside Connect’s body. |
Example
Section titled “Example”Gmail — Connect credential = credential("gmail-support") └─ body: Gmail — Get emails query = "is:unread subject:order" → output: newEmails For each item in newEmails └─ Gmail — Get email by ID id = item["id"] → output: email AI Extract prompt = str(email["body"]) schema = … → output: order Gmail — Download attachments id = email["id"] folder = "C:\orders" → output: filesRelated activities
Section titled “Related activities”- Gmail — Get emails — get the list and its IDs.
- Gmail — Reply — reply to the email.
- Gmail — Download attachments — save its attachments.
- All Gmail activities