apple-mail-mcp 1.1.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -84,8 +84,9 @@ On first use, macOS will ask for permission to automate Mail.app. Click "OK" to
84
84
  | **List Messages** | List messages with pagination, sender filter, date display |
85
85
  | **Search Messages** | Search by sender, subject, content, date range, read/flagged status — across all accounts |
86
86
  | **Read Messages** | Get full email content (plain text or HTML) |
87
- | **Send Email** | Compose and send new emails |
88
- | **Create Draft** | Save emails to Drafts folder |
87
+ | **Send Email** | Compose and send new emails (with optional file attachments) |
88
+ | **Send Serial Email** | Mail merge — send personalized emails to a list of recipients with {{placeholder}} support |
89
+ | **Create Draft** | Save emails to Drafts folder (with optional file attachments) |
89
90
  | **Reply** | Reply to messages (with reply-all support) |
90
91
  | **Forward** | Forward messages to new recipients |
91
92
  | **Mark Read/Unread** | Change read status (single or batch) |
@@ -190,6 +191,7 @@ Send a new email immediately.
190
191
  | `cc` | string[] | No | CC recipients |
191
192
  | `bcc` | string[] | No | BCC recipients |
192
193
  | `account` | string | No | Send from specific account |
194
+ | `attachments` | string[] | No | Absolute file paths to attach (e.g., `["/Users/me/report.pdf"]`) |
193
195
 
194
196
  **Example:**
195
197
  ```json
@@ -197,12 +199,48 @@ Send a new email immediately.
197
199
  "to": ["colleague@company.com"],
198
200
  "subject": "Meeting Tomorrow",
199
201
  "body": "Hi, just confirming our meeting at 2pm tomorrow.",
200
- "account": "Work"
202
+ "account": "Work",
203
+ "attachments": ["/Users/me/Documents/agenda.pdf"]
201
204
  }
202
205
  ```
203
206
 
204
207
  ---
205
208
 
209
+ #### `send-serial-email`
210
+
211
+ Send individual personalized emails to a list of recipients (mail merge). Each recipient receives their own email — recipients don't see each other. Supports `{{placeholder}}` tokens in both subject and body.
212
+
213
+ | Parameter | Type | Required | Description |
214
+ |-----------|------|----------|-------------|
215
+ | `recipients` | object[] | Yes | List of recipients (see below) |
216
+ | `subject` | string | Yes | Email subject — use `{{Key}}` for placeholders |
217
+ | `body` | string | Yes | Email body — use `{{Key}}` for placeholders |
218
+ | `account` | string | No | Send from specific account |
219
+ | `delayMs` | number | No | Delay between sends in ms (default: 500) |
220
+
221
+ Each recipient object:
222
+
223
+ | Field | Type | Required | Description |
224
+ |-------|------|----------|-------------|
225
+ | `email` | string | Yes | Recipient email address |
226
+ | `variables` | object | Yes | Key-value pairs for placeholder replacement |
227
+
228
+ **Example:**
229
+ ```json
230
+ {
231
+ "recipients": [
232
+ { "email": "alice@example.com", "variables": { "Name": "Alice", "Company": "Acme" } },
233
+ { "email": "bob@example.com", "variables": { "Name": "Bob", "Company": "Globex" } }
234
+ ],
235
+ "subject": "Hello {{Name}}!",
236
+ "body": "Dear {{Name}},\n\nGreat to connect about {{Company}}.\n\nBest regards"
237
+ }
238
+ ```
239
+
240
+ **Returns:** Per-recipient success/failure results with a summary count.
241
+
242
+ ---
243
+
206
244
  #### `create-draft`
207
245
 
208
246
  Save an email to Drafts without sending.
@@ -215,6 +253,7 @@ Save an email to Drafts without sending.
215
253
  | `cc` | string[] | No | CC recipients |
216
254
  | `bcc` | string[] | No | BCC recipients |
217
255
  | `account` | string | No | Account for draft |
256
+ | `attachments` | string[] | No | Absolute file paths to attach |
218
257
 
219
258
  **Returns:** Confirmation that draft was created.
220
259
 
@@ -606,6 +645,19 @@ User: "Send it"
606
645
  AI: [User opens Mail.app and sends manually, or AI calls send-email]
607
646
  ```
608
647
 
648
+ ### Sending Personalized Emails (Mail Merge)
649
+
650
+ ```
651
+ User: "Send a personalized email to Alice (alice@acme.com), Bob (bob@globex.com),
652
+ and Carol (carol@initech.com). Subject: 'Project Update for {{Company}}',
653
+ Body: 'Hi {{Name}}, here is the latest update for {{Company}}.'"
654
+ AI: [calls send-serial-email with recipients, subject template, and body template]
655
+ "Successfully sent 3 email(s):
656
+ - alice@acme.com: sent
657
+ - bob@globex.com: sent
658
+ - carol@initech.com: sent"
659
+ ```
660
+
609
661
  ### Organizing Messages
610
662
 
611
663
  ```
@@ -663,7 +715,7 @@ If installed from source, use this configuration:
663
715
  |------------|--------|
664
716
  | macOS only | Apple Mail and AppleScript are macOS-specific |
665
717
  | No sending HTML email | Emails are sent as plain text; reading HTML content is supported |
666
- | No adding attachments | Can list and save existing attachments, but cannot attach files to outgoing emails |
718
+ | Attachments require absolute paths | File attachments must use full absolute paths (e.g., `/Users/me/file.pdf`) |
667
719
  | No smart mailboxes | Cannot access Smart Mailboxes via AppleScript |
668
720
  | In-memory templates | Email templates are not persisted across server restarts |
669
721
 
package/build/index.js CHANGED
@@ -142,13 +142,62 @@ server.tool("send-email", {
142
142
  cc: z.array(z.string()).optional().describe("CC recipients"),
143
143
  bcc: z.array(z.string()).optional().describe("BCC recipients"),
144
144
  account: z.string().optional().describe("Account to send from"),
145
- }, withErrorHandling(({ to, subject, body, cc, bcc, account }) => {
146
- const success = mailManager.sendEmail(to, subject, body, cc, bcc, account);
145
+ attachments: z
146
+ .array(z.string())
147
+ .optional()
148
+ .describe("Absolute file paths to attach (e.g., ['/Users/me/report.pdf'])"),
149
+ }, withErrorHandling(({ to, subject, body, cc, bcc, account, attachments }) => {
150
+ const success = mailManager.sendEmail(to, subject, body, cc, bcc, account, attachments);
147
151
  if (!success) {
148
152
  return errorResponse("Failed to send email. Check Mail.app configuration.");
149
153
  }
150
- return successResponse(`Email sent to ${to.join(", ")}`);
154
+ const attachInfo = attachments?.length ? ` with ${attachments.length} attachment(s)` : "";
155
+ return successResponse(`Email sent to ${to.join(", ")}${attachInfo}`);
151
156
  }, "Error sending email"));
157
+ // --- send-serial-email ---
158
+ server.tool("send-serial-email", {
159
+ recipients: z
160
+ .array(z.object({
161
+ email: z.string().min(1, "Recipient email is required"),
162
+ variables: z
163
+ .record(z.string())
164
+ .describe("Placeholder values, e.g. { Name: 'Alice', Company: 'Acme' }"),
165
+ }))
166
+ .min(1, "At least one recipient is required")
167
+ .max(100, "Cannot send to more than 100 recipients in a single batch")
168
+ .describe("List of recipients with personalization variables (max 100)"),
169
+ subject: z
170
+ .string()
171
+ .min(1, "Subject is required")
172
+ .describe("Subject line — use {{Key}} for placeholders"),
173
+ body: z
174
+ .string()
175
+ .min(1, "Body is required")
176
+ .describe("Email body — use {{Key}} for placeholders"),
177
+ account: z.string().optional().describe("Account to send from"),
178
+ delayMs: z
179
+ .number()
180
+ .min(0)
181
+ .max(10000)
182
+ .optional()
183
+ .describe("Delay between sends in ms (default: 500, max: 10000)"),
184
+ }, withErrorHandling(({ recipients, subject, body, account, delayMs }) => {
185
+ const results = mailManager.sendSerialEmail(recipients, subject, body, account, delayMs);
186
+ const successCount = results.filter((r) => r.success).length;
187
+ const failCount = results.length - successCount;
188
+ const details = results
189
+ .map((r) => ` - ${r.email}: ${r.success ? "sent" : `FAILED (${r.error})`}`)
190
+ .join("\n");
191
+ if (failCount === 0) {
192
+ return successResponse(`Successfully sent ${successCount} email(s):\n${details}`);
193
+ }
194
+ else if (successCount === 0) {
195
+ return errorResponse(`Failed to send all ${failCount} email(s):\n${details}`);
196
+ }
197
+ else {
198
+ return successResponse(`Sent ${successCount} of ${results.length} email(s), ${failCount} failed:\n${details}`);
199
+ }
200
+ }, "Error sending serial emails"));
152
201
  // --- create-draft ---
153
202
  server.tool("create-draft", {
154
203
  to: z.array(z.string()).min(1, "At least one recipient is required"),
@@ -157,12 +206,17 @@ server.tool("create-draft", {
157
206
  cc: z.array(z.string()).optional().describe("CC recipients"),
158
207
  bcc: z.array(z.string()).optional().describe("BCC recipients"),
159
208
  account: z.string().optional().describe("Account to create draft in"),
160
- }, withErrorHandling(({ to, subject, body, cc, bcc, account }) => {
161
- const success = mailManager.createDraft(to, subject, body, cc, bcc, account);
209
+ attachments: z
210
+ .array(z.string())
211
+ .optional()
212
+ .describe("Absolute file paths to attach (e.g., ['/Users/me/report.pdf'])"),
213
+ }, withErrorHandling(({ to, subject, body, cc, bcc, account, attachments }) => {
214
+ const success = mailManager.createDraft(to, subject, body, cc, bcc, account, attachments);
162
215
  if (!success) {
163
216
  return errorResponse("Failed to create draft. Check Mail.app configuration.");
164
217
  }
165
- return successResponse(`Draft created for ${to.join(", ")}`);
218
+ const attachInfo = attachments?.length ? ` with ${attachments.length} attachment(s)` : "";
219
+ return successResponse(`Draft created for ${to.join(", ")}${attachInfo}`);
166
220
  }, "Error creating draft"));
167
221
  // --- reply-to-message ---
168
222
  server.tool("reply-to-message", {
@@ -12,7 +12,7 @@
12
12
  *
13
13
  * @module services/appleMailManager
14
14
  */
15
- import type { Message, MessageContent, Mailbox, Account, Attachment, HealthCheckResult, MailStats, BatchOperationResult, SyncStatus, RecentlyReceivedStats, MailRule, Contact, EmailTemplate } from "../types.js";
15
+ import type { Message, MessageContent, Mailbox, Account, Attachment, HealthCheckResult, MailStats, BatchOperationResult, SyncStatus, RecentlyReceivedStats, MailRule, Contact, EmailTemplate, SerialEmailRecipient, SerialEmailResult } from "../types.js";
16
16
  /**
17
17
  * Manager class for Apple Mail operations.
18
18
  *
@@ -124,7 +124,21 @@ export declare class AppleMailManager {
124
124
  * @param account - Account to send from
125
125
  * @returns true if sent successfully
126
126
  */
127
- sendEmail(to: string[], subject: string, body: string, cc?: string[], bcc?: string[], account?: string): boolean;
127
+ sendEmail(to: string[], subject: string, body: string, cc?: string[], bcc?: string[], account?: string, attachments?: string[]): boolean;
128
+ /**
129
+ * Send individual personalized emails to a list of recipients (mail merge).
130
+ *
131
+ * Replaces {{placeholder}} tokens in subject and body with per-recipient values.
132
+ * Each recipient receives their own individual email.
133
+ *
134
+ * @param recipients - List of recipient objects with email and variable values
135
+ * @param subject - Email subject (may contain {{placeholders}})
136
+ * @param body - Email body (may contain {{placeholders}})
137
+ * @param account - Account to send from
138
+ * @param delayMs - Delay between sends in milliseconds (default: 500, max: 10000)
139
+ * @returns Array of per-recipient results
140
+ */
141
+ sendSerialEmail(recipients: SerialEmailRecipient[], subject: string, body: string, account?: string, delayMs?: number): SerialEmailResult[];
128
142
  /**
129
143
  * Create a draft email (saved to Drafts folder, not sent).
130
144
  *
@@ -136,7 +150,7 @@ export declare class AppleMailManager {
136
150
  * @param account - Account to create draft in
137
151
  * @returns true if draft created successfully
138
152
  */
139
- createDraft(to: string[], subject: string, body: string, cc?: string[], bcc?: string[], account?: string): boolean;
153
+ createDraft(to: string[], subject: string, body: string, cc?: string[], bcc?: string[], account?: string, attachments?: string[]): boolean;
140
154
  /**
141
155
  * Reply to a message.
142
156
  *
@@ -1 +1 @@
1
- {"version":3,"file":"appleMailManager.d.ts","sourceRoot":"","sources":["../../src/services/appleMailManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,OAAO,EACP,OAAO,EACP,UAAU,EACV,iBAAiB,EACjB,SAAS,EAET,oBAAoB,EACpB,UAAU,EACV,qBAAqB,EACrB,QAAQ,EACR,OAAO,EACP,aAAa,EACd,MAAM,YAAY,CAAC;AA8EpB;;;;;;;;;;;;GAYG;AACH,qBAAa,gBAAgB;IAC3B;;OAEG;IACH,OAAO,CAAC,cAAc,CAAuB;IAE7C;;;;OAIG;IACH,OAAO,CAAC,KAAK,CAGX;IAEF,8CAA8C;IAC9C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAU;IAEvC;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAUzB;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IAW7B;;;OAGG;IACH,OAAO,CAAC,eAAe;IAKvB;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAwCtB;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAO,CAAC,cAAc;IAyCtB;;;;;;;;OAQG;IACH,cAAc,CACZ,KAAK,CAAC,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,EAChB,KAAK,SAAK,EACV,QAAQ,CAAC,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,EAAE;IA2EZ;;;;;OAKG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I,CAAC,EAAE,MAAM,CAAA;KAAE,GAC5E,OAAO;IAkBV;;OAEG;IACH,WAAW,IAAI,iBAAiB;IA8EhC;;OAEG;IACH,YAAY,IAAI,SAAS;IA4CzB;;;;;;;OAOG;IACH,wBAAwB,IAAI,qBAAqB;IAyEjD;;;;;;;;;OASG;IACH,aAAa,IAAI,UAAU;CA+D5B"}
1
+ {"version":3,"file":"appleMailManager.d.ts","sourceRoot":"","sources":["../../src/services/appleMailManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,OAAO,EACP,OAAO,EACP,UAAU,EACV,iBAAiB,EACjB,SAAS,EAET,oBAAoB,EACpB,UAAU,EACV,qBAAqB,EACrB,QAAQ,EACR,OAAO,EACP,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AA6HpB;;;;;;;;;;;;GAYG;AACH,qBAAa,gBAAgB;IAC3B;;OAEG;IACH,OAAO,CAAC,cAAc,CAAuB;IAE7C;;;;OAIG;IACH,OAAO,CAAC,KAAK,CAGX;IAEF,8CAA8C;IAC9C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAU;IAEvC;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAUzB;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IAW7B;;;OAGG;IACH,OAAO,CAAC,eAAe;IAKvB;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAwCtB;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAO,CAAC,cAAc;IAyCtB;;;;;;;;OAQG;IACH,cAAc,CACZ,KAAK,CAAC,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,EAChB,KAAK,SAAK,EACV,QAAQ,CAAC,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,EAAE;IA4EZ;;;;;OAKG;IACH,cAAc,CAAC,EAA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H,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAInC;;OAEG;IACH,WAAW,CACT,EAAE,EAAE,MAAM,EACV,SAAS,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAC5E,OAAO;IAkBV;;OAEG;IACH,WAAW,IAAI,iBAAiB;IA8EhC;;OAEG;IACH,YAAY,IAAI,SAAS;IA4CzB;;;;;;;OAOG;IACH,wBAAwB,IAAI,qBAAqB;IAyEjD;;;;;;;;;OASG;IACH,aAAa,IAAI,UAAU;CA+D5B"}
@@ -12,6 +12,9 @@
12
12
  *
13
13
  * @module services/appleMailManager
14
14
  */
15
+ import { spawnSync } from "child_process";
16
+ import { existsSync } from "fs";
17
+ import { isAbsolute } from "path";
15
18
  import { executeAppleScript } from "../utils/applescript.js";
16
19
  // =============================================================================
17
20
  // Text Processing Utilities
@@ -32,16 +35,54 @@ function escapeForAppleScript(text) {
32
35
  return text.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
33
36
  }
34
37
  /**
35
- * Parses AppleScript date representation to JavaScript Date.
38
+ * Validates attachment file paths and builds AppleScript commands to attach them.
36
39
  *
37
- * AppleScript returns dates in a verbose format like:
38
- * "date Saturday, December 27, 2025 at 3:44:02 PM"
40
+ * @param attachments - Absolute file paths to attach
41
+ * @returns AppleScript commands to add attachments, or empty string if none
42
+ * @throws Error if any path is not absolute or does not exist
43
+ */
44
+ function buildAttachmentCommands(attachments) {
45
+ if (!attachments || attachments.length === 0)
46
+ return "";
47
+ for (const filePath of attachments) {
48
+ if (!isAbsolute(filePath)) {
49
+ throw new Error(`Attachment path must be absolute: "${filePath}"`);
50
+ }
51
+ if (!existsSync(filePath)) {
52
+ throw new Error(`Attachment file not found: "${filePath}"`);
53
+ }
54
+ }
55
+ let commands = "";
56
+ for (const filePath of attachments) {
57
+ const safePath = escapeForAppleScript(filePath);
58
+ commands += `make new attachment with properties {file name:POSIX file "${safePath}"} at after the last paragraph\n`;
59
+ }
60
+ return commands;
61
+ }
62
+ /**
63
+ * AppleScript snippet that converts a date variable `d` into a
64
+ * locale-independent numeric string: "YYYY-M-D-H-m-s".
65
+ * Use: set d to date received of msg, then inline this snippet.
66
+ */
67
+ const AS_DATE_TO_STRING = `((year of d) as string) & "-" & ((month of d as integer) as string) & "-" & ((day of d) as string) & "-" & ((hours of d) as string) & "-" & ((minutes of d) as string) & "-" & ((seconds of d) as string)`;
68
+ /**
69
+ * Parses a locale-independent date string "YYYY-M-D-H-m-s"
70
+ * produced by the AppleScript snippet above.
71
+ *
72
+ * Falls back to the locale-dependent `as string` format for
73
+ * backwards compatibility, and finally to current date.
39
74
  *
40
- * @param appleScriptDate - Date string from AppleScript
75
+ * @param dateStr - Date string from AppleScript
41
76
  * @returns Parsed Date, or current date if parsing fails
42
77
  */
43
- function parseAppleScriptDate(appleScriptDate) {
44
- const withoutPrefix = appleScriptDate.replace(/^date\s+/, "");
78
+ function parseAppleScriptDate(dateStr) {
79
+ // Try locale-independent numeric format first: "YYYY-M-D-H-m-s"
80
+ const numParts = dateStr.split("-").map(Number);
81
+ if (numParts.length === 6 && numParts.every((n) => !isNaN(n))) {
82
+ return new Date(numParts[0], numParts[1] - 1, numParts[2], numParts[3], numParts[4], numParts[5]);
83
+ }
84
+ // Fallback: try legacy locale-dependent format
85
+ const withoutPrefix = dateStr.replace(/^date\s+/, "");
45
86
  const normalized = withoutPrefix.replace(" at ", " ");
46
87
  const parsed = new Date(normalized);
47
88
  return isNaN(parsed.getTime()) ? new Date() : parsed;
@@ -293,7 +334,8 @@ export class AppleMailManager {
293
334
  set msgId to id of msg as string
294
335
  set msgSubject to subject of msg
295
336
  set msgSender to sender of msg
296
- set msgDateStr to date received of msg as string
337
+ set d to date received of msg
338
+ set msgDateStr to ${AS_DATE_TO_STRING}
297
339
  set msgRead to read status of msg as string
298
340
  set msgFlagged to flagged status of msg as string
299
341
  if msgCount > 0 then set outputText to outputText & "|||ITEM|||"
@@ -331,7 +373,8 @@ export class AppleMailManager {
331
373
  set msg to item 1 of matchingMsgs
332
374
  set msgSubject to subject of msg
333
375
  set msgSender to sender of msg
334
- set msgDate to date received of msg as string
376
+ set d to date received of msg
377
+ set msgDate to ${AS_DATE_TO_STRING}
335
378
  set msgRead to read status of msg as string
336
379
  set msgFlagged to flagged status of msg as string
337
380
  set msgJunk to junk mail status of msg as string
@@ -445,7 +488,8 @@ export class AppleMailManager {
445
488
  set msgId to id of msg as string
446
489
  set msgSubject to subject of msg
447
490
  set msgSender to sender of msg
448
- set msgDate to date received of msg as string
491
+ set d to date received of msg
492
+ set msgDate to ${AS_DATE_TO_STRING}
449
493
  set msgRead to read status of msg as string
450
494
  set msgFlagged to flagged status of msg as string
451
495
  if msgCount > 0 then set outputText to outputText & "|||ITEM|||"
@@ -504,7 +548,7 @@ export class AppleMailManager {
504
548
  * @param account - Account to send from
505
549
  * @returns true if sent successfully
506
550
  */
507
- sendEmail(to, subject, body, cc, bcc, account) {
551
+ sendEmail(to, subject, body, cc, bcc, account, attachments) {
508
552
  const safeSubject = escapeForAppleScript(subject);
509
553
  const safeBody = escapeForAppleScript(body);
510
554
  // Build recipient additions
@@ -522,6 +566,7 @@ export class AppleMailManager {
522
566
  recipientCommands += `make new bcc recipient at end of bcc recipients with properties {address:"${escapeForAppleScript(addr)}"}\n`;
523
567
  }
524
568
  }
569
+ const attachmentCommands = buildAttachmentCommands(attachments);
525
570
  let sendCommand;
526
571
  if (account) {
527
572
  const safeAccount = escapeForAppleScript(account);
@@ -530,6 +575,7 @@ export class AppleMailManager {
530
575
  tell newMessage
531
576
  ${recipientCommands}
532
577
  set sender to "${safeAccount}"
578
+ ${attachmentCommands}
533
579
  end tell
534
580
  send newMessage
535
581
  return "sent"
@@ -540,19 +586,69 @@ export class AppleMailManager {
540
586
  set newMessage to make new outgoing message with properties {subject:"${safeSubject}", content:"${safeBody}", visible:true}
541
587
  tell newMessage
542
588
  ${recipientCommands}
589
+ ${attachmentCommands}
543
590
  end tell
544
591
  send newMessage
545
592
  return "sent"
546
593
  `;
547
594
  }
548
595
  const script = buildAppLevelScript(sendCommand);
549
- const result = executeAppleScript(script);
596
+ const result = executeAppleScript(script, { timeoutMs: 60000, maxRetries: 2 });
550
597
  if (!result.success) {
551
598
  console.error(`Failed to send email: ${result.error}`);
552
599
  return false;
553
600
  }
554
601
  return result.output.includes("sent");
555
602
  }
603
+ /**
604
+ * Send individual personalized emails to a list of recipients (mail merge).
605
+ *
606
+ * Replaces {{placeholder}} tokens in subject and body with per-recipient values.
607
+ * Each recipient receives their own individual email.
608
+ *
609
+ * @param recipients - List of recipient objects with email and variable values
610
+ * @param subject - Email subject (may contain {{placeholders}})
611
+ * @param body - Email body (may contain {{placeholders}})
612
+ * @param account - Account to send from
613
+ * @param delayMs - Delay between sends in milliseconds (default: 500, max: 10000)
614
+ * @returns Array of per-recipient results
615
+ */
616
+ sendSerialEmail(recipients, subject, body, account, delayMs = 500) {
617
+ const effectiveDelay = Math.min(Math.max(delayMs, 0), 10000);
618
+ const results = [];
619
+ for (let i = 0; i < recipients.length; i++) {
620
+ const recipient = recipients[i];
621
+ try {
622
+ // Replace all {{Key}} placeholders with recipient's values
623
+ let personalizedSubject = subject;
624
+ let personalizedBody = body;
625
+ for (const [key, value] of Object.entries(recipient.variables)) {
626
+ const safeKey = key.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
627
+ const placeholder = new RegExp(`\\{\\{${safeKey}\\}\\}`, "g");
628
+ personalizedSubject = personalizedSubject.replace(placeholder, value);
629
+ personalizedBody = personalizedBody.replace(placeholder, value);
630
+ }
631
+ const success = this.sendEmail([recipient.email], personalizedSubject, personalizedBody, undefined, undefined, account);
632
+ results.push({
633
+ email: recipient.email,
634
+ success,
635
+ error: success ? undefined : "Failed to send email",
636
+ });
637
+ }
638
+ catch (error) {
639
+ results.push({
640
+ email: recipient.email,
641
+ success: false,
642
+ error: error instanceof Error ? error.message : "Unknown error",
643
+ });
644
+ }
645
+ // Brief delay between sends to avoid overwhelming Mail.app
646
+ if (effectiveDelay > 0 && i < recipients.length - 1) {
647
+ spawnSync("sleep", [(effectiveDelay / 1000).toString()], { stdio: "ignore" });
648
+ }
649
+ }
650
+ return results;
651
+ }
556
652
  /**
557
653
  * Create a draft email (saved to Drafts folder, not sent).
558
654
  *
@@ -564,7 +660,7 @@ export class AppleMailManager {
564
660
  * @param account - Account to create draft in
565
661
  * @returns true if draft created successfully
566
662
  */
567
- createDraft(to, subject, body, cc, bcc, account) {
663
+ createDraft(to, subject, body, cc, bcc, account, attachments) {
568
664
  const safeSubject = escapeForAppleScript(subject);
569
665
  const safeBody = escapeForAppleScript(body);
570
666
  // Build recipient additions
@@ -582,6 +678,7 @@ export class AppleMailManager {
582
678
  recipientCommands += `make new bcc recipient at end of bcc recipients with properties {address:"${escapeForAppleScript(addr)}"}\n`;
583
679
  }
584
680
  }
681
+ const attachmentCommands = buildAttachmentCommands(attachments);
585
682
  let draftCommand;
586
683
  if (account) {
587
684
  const safeAccount = escapeForAppleScript(account);
@@ -590,6 +687,7 @@ export class AppleMailManager {
590
687
  tell newMessage
591
688
  ${recipientCommands}
592
689
  set sender to "${safeAccount}"
690
+ ${attachmentCommands}
593
691
  end tell
594
692
  return "draft created"
595
693
  `;
@@ -599,12 +697,13 @@ export class AppleMailManager {
599
697
  set newMessage to make new outgoing message with properties {subject:"${safeSubject}", content:"${safeBody}", visible:false}
600
698
  tell newMessage
601
699
  ${recipientCommands}
700
+ ${attachmentCommands}
602
701
  end tell
603
702
  return "draft created"
604
703
  `;
605
704
  }
606
705
  const script = buildAppLevelScript(draftCommand);
607
- const result = executeAppleScript(script);
706
+ const result = executeAppleScript(script, { timeoutMs: 60000, maxRetries: 2 });
608
707
  if (!result.success) {
609
708
  console.error(`Failed to create draft: ${result.error}`);
610
709
  return false;
package/build/types.d.ts CHANGED
@@ -207,6 +207,26 @@ export interface MoveMessageParams {
207
207
  /** Account containing the destination mailbox */
208
208
  account?: string;
209
209
  }
210
+ /**
211
+ * A single recipient in a serial email (mail merge) operation.
212
+ */
213
+ export interface SerialEmailRecipient {
214
+ /** Recipient email address */
215
+ email: string;
216
+ /** Variable values for placeholder replacement (e.g., { Name: "Alice", Company: "Acme" }) */
217
+ variables: Record<string, string>;
218
+ }
219
+ /**
220
+ * Result of sending a serial email to a single recipient.
221
+ */
222
+ export interface SerialEmailResult {
223
+ /** Recipient email address */
224
+ email: string;
225
+ /** Whether the email was sent successfully */
226
+ success: boolean;
227
+ /** Error message if sending failed */
228
+ error?: string;
229
+ }
210
230
  /**
211
231
  * Individual check result in a health check.
212
232
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,wCAAwC;IACxC,EAAE,EAAE,MAAM,CAAC;IAEX,gCAAgC;IAChC,OAAO,EAAE,MAAM,CAAC;IAEhB,2BAA2B;IAC3B,MAAM,EAAE,MAAM,CAAC;IAEf,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,4BAA4B;IAC5B,UAAU,EAAE,MAAM,EAAE,CAAC;IAErB,oBAAoB;IACpB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAExB,oDAAoD;IACpD,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IAEzB,oCAAoC;IACpC,YAAY,EAAE,IAAI,CAAC;IAEnB,gCAAgC;IAChC,QAAQ,CAAC,EAAE,IAAI,CAAC;IAEhB,wCAAwC;IACxC,MAAM,EAAE,OAAO,CAAC;IAEhB,qCAAqC;IACrC,SAAS,EAAE,OAAO,CAAC;IAEnB,4CAA4C;IAC5C,MAAM,EAAE,OAAO,CAAC;IAEhB,2CAA2C;IAC3C,SAAS,EAAE,OA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vB,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IAEb,kCAAkC;IAClC,OAAO,EAAE,OAAO,CAAC;CAClB;AAMD;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IAEb,sBAAsB;IACtB,MAAM,EAAE,MAAM,EAAE,CAAC;IAEjB,oBAAoB;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAMD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,0BAA0B;IAC1B,EAAE,EAAE,MAAM,CAAC;IAEX,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;IAEb,2BAA2B;IAC3B,OAAO,EAAE,MAAM,CAAC;IAEhB,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;IAEb,yBAAyB;IACzB,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;IAEd,4BAA4B;IAC5B,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;CACf;AAMD;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,yCAAyC;IACzC,YAAY,EAAE,OAAO,CAAC;IAEtB,qCAAqC;IACrC,aAAa,EAAE,MAAM,CAAC;IAEtB,iDAAiD;IACjD,cAAc,EAAE,OAAO,CAAC;IAExB,yCAAyC;IACzC,sBAAsB,EAAE,MAAM,CAAC;IAE/B,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apple-mail-mcp",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "MCP server for Apple Mail - read, search, send, and manage emails via Claude",
5
5
  "type": "module",
6
6
  "main": "build/index.js",