Skip to content

Commit 1a521b1

Browse files
Adam GoughAdam Gough
authored andcommitted
changed just gmail
1 parent 75963eb commit 1a521b1

File tree

4 files changed

+73
-10
lines changed

4 files changed

+73
-10
lines changed

apps/sim/blocks/blocks/gmail.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,27 @@ export const GmailBlock: BlockConfig<GmailToolResponse> = {
7272
condition: { field: 'operation', value: ['send_gmail', 'draft_gmail'] },
7373
required: true,
7474
},
75+
// Advanced Settings - Additional Recipients
76+
{
77+
id: 'cc',
78+
title: 'CC',
79+
type: 'short-input',
80+
layout: 'full',
81+
placeholder: 'CC recipients (comma-separated)',
82+
condition: { field: 'operation', value: ['send_gmail', 'draft_gmail'] },
83+
mode: 'advanced',
84+
required: false,
85+
},
86+
{
87+
id: 'bcc',
88+
title: 'BCC',
89+
type: 'short-input',
90+
layout: 'full',
91+
placeholder: 'BCC recipients (comma-separated)',
92+
condition: { field: 'operation', value: ['send_gmail', 'draft_gmail'] },
93+
mode: 'advanced',
94+
required: false,
95+
},
7596
// Label/folder selector (basic mode)
7697
{
7798
id: 'folder',
@@ -182,6 +203,8 @@ export const GmailBlock: BlockConfig<GmailToolResponse> = {
182203
to: { type: 'string', description: 'Recipient email address' },
183204
subject: { type: 'string', description: 'Email subject' },
184205
body: { type: 'string', description: 'Email content' },
206+
cc: { type: 'string', description: 'CC recipients (comma-separated)' },
207+
bcc: { type: 'string', description: 'BCC recipients (comma-separated)' },
185208
// Read operation inputs
186209
folder: { type: 'string', description: 'Gmail folder' },
187210
manualFolder: { type: 'string', description: 'Manual folder name' },

apps/sim/tools/gmail/draft.ts

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,18 @@ export const gmailDraftTool: ToolConfig<GmailSendParams, GmailToolResponse> = {
4040
visibility: 'user-or-llm',
4141
description: 'Email body content',
4242
},
43+
cc: {
44+
type: 'string',
45+
required: false,
46+
visibility: 'user-or-llm',
47+
description: 'CC recipients (comma-separated)',
48+
},
49+
bcc: {
50+
type: 'string',
51+
required: false,
52+
visibility: 'user-or-llm',
53+
description: 'BCC recipients (comma-separated)',
54+
},
4355
},
4456

4557
request: {
@@ -50,14 +62,21 @@ export const gmailDraftTool: ToolConfig<GmailSendParams, GmailToolResponse> = {
5062
'Content-Type': 'application/json',
5163
}),
5264
body: (params: GmailSendParams): Record<string, any> => {
53-
const email = [
65+
const emailHeaders = [
5466
'Content-Type: text/plain; charset="UTF-8"',
5567
'MIME-Version: 1.0',
5668
`To: ${params.to}`,
57-
`Subject: ${params.subject}`,
58-
'',
59-
params.body,
60-
].join('\n')
69+
]
70+
71+
if (params.cc) {
72+
emailHeaders.push(`Cc: ${params.cc}`)
73+
}
74+
if (params.bcc) {
75+
emailHeaders.push(`Bcc: ${params.bcc}`)
76+
}
77+
78+
emailHeaders.push(`Subject: ${params.subject}`, '', params.body)
79+
const email = emailHeaders.join('\n')
6180

6281
return {
6382
message: {

apps/sim/tools/gmail/send.ts

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,18 @@ export const gmailSendTool: ToolConfig<GmailSendParams, GmailToolResponse> = {
4040
visibility: 'user-or-llm',
4141
description: 'Email body content',
4242
},
43+
cc: {
44+
type: 'string',
45+
required: false,
46+
visibility: 'user-or-llm',
47+
description: 'CC recipients (comma-separated)',
48+
},
49+
bcc: {
50+
type: 'string',
51+
required: false,
52+
visibility: 'user-or-llm',
53+
description: 'BCC recipients (comma-separated)',
54+
},
4355
},
4456

4557
request: {
@@ -50,14 +62,21 @@ export const gmailSendTool: ToolConfig<GmailSendParams, GmailToolResponse> = {
5062
'Content-Type': 'application/json',
5163
}),
5264
body: (params: GmailSendParams): Record<string, any> => {
53-
const email = [
65+
const emailHeaders = [
5466
'Content-Type: text/plain; charset="UTF-8"',
5567
'MIME-Version: 1.0',
5668
`To: ${params.to}`,
57-
`Subject: ${params.subject}`,
58-
'',
59-
params.body,
60-
].join('\n')
69+
]
70+
71+
if (params.cc) {
72+
emailHeaders.push(`Cc: ${params.cc}`)
73+
}
74+
if (params.bcc) {
75+
emailHeaders.push(`Bcc: ${params.bcc}`)
76+
}
77+
78+
emailHeaders.push(`Subject: ${params.subject}`, '', params.body)
79+
const email = emailHeaders.join('\n')
6180

6281
return {
6382
raw: Buffer.from(email).toString('base64url'),

apps/sim/tools/gmail/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ interface BaseGmailParams {
88
// Send operation parameters
99
export interface GmailSendParams extends BaseGmailParams {
1010
to: string
11+
cc?: string
12+
bcc?: string
1113
subject: string
1214
body: string
1315
}

0 commit comments

Comments
 (0)