Gmail ACTION
Send Email
Send a new email OR reply to an existing thread from the authenticated Gmail account. For a fresh message, set
to/subject/body; leave inReplyToMessageId blank. To reply to a thread, pass the id of any message in that thread as inReplyToMessageId — the tool preserves threading (References, In-Reply-To, threadId) and auto-prefixes Re: on the subject. Use Find Emails or Get Thread to locate the message ID. Set replyAll: true to fan-out to the original From/To/Cc (minus the user's own address); otherwise only the original sender is addressed. bodyType controls whether body is treated as plain text (default) or HTML. To send to yourself, pass "me" in to — the action resolves it to the authenticated user's email address. No pre-call to Get Current User required. Attachments: for small inline content (the common case in MCP / cloud runs), set attachmentContent to the file's text contents and attachmentFilename to its name. For files already on disk (Pipedream workflows, File Stash), use attachments[] + attachmentFilenames[] instead. See the documentation.- Action
- Writes data
- OAuth
- SDK
- MCP
IMPLEMENTATION
Call this tool
Connect a user's Gmail account once, then configure and run Send Email from your backend or agent.
import { PipedreamClient } from "@pipedream/sdk"
const pd = new PipedreamClient({
projectId: process.env.PIPEDREAM_PROJECT_ID!,
clientId: process.env.PIPEDREAM_CLIENT_ID!,
clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
projectEnvironment: "production",
})
const result = await pd.actions.run({
id: "gmail-send-email",
externalUserId: "{external_user_id}", // any stable ID for this user in your system
configuredProps: {
gmail: { authProvisionId: "apn_xxxxxxx" },
to: ["To"],
cc: ["Cc"],
},
})
console.log(result)curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
-H "Content-Type: application/json" \
-H "X-PD-Environment: production" \
-H "Authorization: Bearer {access_token}" \
-d '{
"external_user_id": "{external_user_id}",
"id": "gmail-send-email",
"configured_props": {
"gmail": { "authProvisionId": "apn_xxxxxxx" },
"to": ["To"],
"cc": ["Cc"]
}
}'// accessToken: mint a short-lived token with the Connect SDK — see the MCP guide
const transport = new StreamableHTTPClientTransport(
new URL("https://remote.mcp.pipedream.net/v3"),
{
requestInit: {
headers: {
Authorization: `Bearer ${accessToken}`,
"x-pd-project-id": "{project_id}",
"x-pd-environment": "production",
"x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
"x-pd-app-slug": "gmail",
},
},
},
)
const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)
const { tools } = await mcp.listTools()
// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
name: "gmail-send-email",
arguments: {
to: ["To"],
cc: ["Cc"],
},
})SCHEMA
Inputs
Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.
| Property | Type | Description |
|---|---|---|
to To | string[] | Recipient email addresses. Pass "me" to send to yourself — the action resolves it to the authenticated user's email address. Ignored when replyAll is true (recipients are computed from the original message). Optional |
cc Cc | string[] | Cc recipient email addresses. Pass "me" to include yourself. Optional |
bcc Bcc | string[] | Bcc recipient email addresses. Pass "me" to include yourself. Optional |
subject Subject | string | Subject line. When inReplyToMessageId is set, the subject is taken from the replied-to message with Re: prefixed and this value is ignored. Optional |
body Email Body | string | Include an email body as either plain text or HTML. If HTML, make sure to set the "Body Type" prop to html. Required |
bodyType Body Type | string | Choose to send as plain text or HTML. Defaults to plaintext. Optional |
fromName From Name | string | Specify the name that will be displayed in the "From" section of the email. Optional |
fromEmail From Email | string | Specify the email address that will be displayed in the "From" section of the email. Optional Dynamic |
replyTo Reply To | string | Specify the email address that will appear on the "Reply-To" field, if different than the sender's email. Optional |
inReplyToMessageId In Reply To Message ID | string | To send this email as a reply, pass the id of any message in the target thread (from Find Emails or Get Thread). The action will preserve References/In-Reply-To headers, thread correctly, and auto-prefix Re: on the subject. Optional |
replyAll Reply All | boolean | When inReplyToMessageId is set, fan-out recipients to the original From/To/Cc (minus the user's own address). Ignored when inReplyToMessageId is blank. Optional |
attachmentContent Attachment Content | string | Inline text content to attach as a file. Use this instead of a file path when running in an MCP / cloud environment where there is no local filesystem to read from. Optional |
attachmentFilename Attachment Filename | string | Filename for the inline attachment (include extension, e.g. dna.txt). Used only when attachmentContent is provided. Defaults to attachment.txt. Optional |
attachmentFilenames Attachment Filenames | string[] | Filenames for each attached file (include the extension, e.g. report.pdf, dna.txt). Must be the same length as attachments — index i in this list pairs with index i in attachments. Optional |
attachments Attachments | string[] | Paths to files on disk (or public URLs). Each entry pairs with the same-index entry in attachmentFilenames[]. If running in MCP or a cloud environment without a local filesystem, use attachmentContent instead. Optional |
syncDir SyncDir | dir | Optional |
REFERENCE
Tool details
Behavior hints are published with the component in the Pipedream registry and surface as MCP tool annotations, so an agent can reason about a tool before it calls it.
- Registry key
- gmail-send-email
- Version
- 0.3.3
- App
- Gmail
- Authentication
- OAuth
- Read-only
- No
- Destructive
- No
- Open world
- Yes
- Source
- View on GitHub ↗