Skip to content

gmail.sendFromTemplate — template rendering + send #48

@AojdevStudio

Description

@AojdevStudio

Summary

Implement gmail.sendFromTemplate operation that renders Mustache-style templates (subject + body) with provided variables and sends the email. Includes a shared renderTemplate() utility function reused by dryRun and sendBatch.

Context

  • Repository: ~/Projects/local-mcps/gdrive
  • GitHub: AojdevStudio/gdrive
  • Plan Doc: docs/plans/2026-03-10-email-outreach-features.md (Task 2)
  • Relevant Files: src/modules/gmail/send.ts, src/modules/gmail/template.ts (new), src/sdk/spec.ts, src/sdk/runtime.ts
  • Related Issues: None (first issue in email outreach feature set)

Current Behavior

N/A — new feature. Gmail module only supports raw sendMessage with no template support.

Expected Behavior

gmail.sendFromTemplate accepts a template string (subject + body with {{variable}} placeholders), a variables object, and recipient info. It renders the template via renderTemplate() and sends via existing buildEmailMessage() + Gmail API.

Acceptance Criteria (max 3)

  • AC-1: renderTemplate() correctly substitutes all {{variable}} placeholders in both subject and body strings
  • AC-2: gmail.sendFromTemplate sends a rendered email and returns the Gmail message ID
  • AC-3: Missing template variables throw a descriptive validation error before sending

Scope

In scope: renderTemplate() shared utility, sendFromTemplate operation, SDK spec + runtime registration, unit tests
Out of scope: Template storage/persistence, HTML template library integration, attachment support in templates

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions