Gmail Draft Creation Instructions¶
Purpose¶
These instructions guide AI agents to convert a generated newsletter HTML file into a Gmail draft email using the MCP Gmail server.
Prerequisites¶
- Newsletter HTML file has been generated using
template_instructions.md - MCP Gmail server is configured and accessible
- User has Gmail authentication set up
Step-by-Step Process¶
Step 1: Read the Newsletter HTML File¶
- Locate and read the generated newsletter HTML file (typically named like
issue-XXX-newsletter.html) - Confirm the HTML contains complete newsletter content with proper formatting
- Verify all links are clean URLs without file extensions
Step 2: Extract Newsletter Metadata¶
From the HTML file, extract:
- Issue number: Look for "Issue #X" in the meta-info section
- Issue date: Extract from meta-info section (format: "Month DD, YYYY")
- Newsletter name: Extract from the <h1> tag in header (e.g., "AI Pulse")
- Featured article title: Extract from the hero article title for subject line
Step 3: Craft Professional Subject Line¶
Create subject line using this format:
Examples:
- AI Pulse Issue #1 - Passive Investing's $13T Cognitive Labor Blind Spot
- AI Pulse Issue #2 - Enterprise RAG Architecture Reality Check
Guidelines: - Keep under 60 characters when possible - Focus on the business impact or key insight - Use numbers/dollar amounts when relevant for executive attention - Avoid technical jargon - use plain business language
Step 4: Convert to Inline CSS¶
CRITICAL: Email clients strip <style> tags. Convert all CSS to inline styles for proper rendering.
Automated Process:
1. Parse the <style> section to extract all CSS rules
2. Match CSS selectors to HTML elements
3. Apply corresponding styles as style="..." attributes on each element
4. Remove <style> and </style> tags entirely
5. Preserve <link> tags for web fonts (Gmail supports these)
AI Implementation Approach:
- Systematically process each CSS class and ID selector
- Apply styles to matching HTML elements throughout the document
- Handle complex selectors (e.g., .hero-article .article-title a)
- Preserve cascade order when multiple rules apply to same element
Key styles to inline:
- Background colors: #202124, #282a2e, gradients
- Text colors: #ffffff, #d0d0d0, #9aa0a6, #2AA1FF
- Typography: font sizes, weights, line heights
- Layout: padding, margins, flexbox properties
- Borders and shadows: border: 1px solid #3b3b3b, box shadows
Example conversion:
<!-- FROM (doesn't work in Gmail): -->
<div class="email-container">
<!-- TO (works in Gmail): -->
<div style="max-width: 600px; margin: 0 auto; background-color: #282a2e; box-shadow: 0 8px 32px rgba(0,0,0,0.4); border-radius: 8px; overflow: hidden;">
Step 5: Prepare Recipients List¶
Default recipients for internal executive newsletters: - Use user-specified recipient list - For testing: Use user's own email address - For distribution: Typically executive team or specified distribution list
Step 6: Create Gmail Draft Using MCP Server¶
Use the MCP Gmail server draft_email function with these parameters:
mcp__gongrzhe-server-gmail-autoauth-mcp__draft_email
Parameters:
- to: [recipient list array]
- subject: [crafted subject line from Step 3]
- body: [complete HTML content from Step 1]
- mimeType: "text/html"
Important Notes:
- Use mimeType: "text/html" for proper HTML rendering
- Include the complete HTML from <html> to </html>
- Do not modify the HTML content - use it exactly as generated
- The Gmail MCP server will handle HTML email formatting automatically
Step 7: Confirm Draft Creation¶
- Verify the draft was created successfully
- Note the draft ID or confirmation message
- Inform user that the draft is ready for review in Gmail
Step 8: Provide Next Steps to User¶
Inform the user: - Draft email has been created in Gmail - Subject line used - Number of recipients - Recommend reviewing the draft in Gmail before sending - Suggest any timing considerations for executive distribution
Example Implementation¶
# After reading issue-001-newsletter.html:
Subject: "AI Pulse Issue #1 - Passive Investing's $13T Cognitive Labor Blind Spot"
Recipients: [user-specified list]
Content: [Full HTML from newsletter file]
MimeType: text/html
# MCP Gmail Draft Call:
mcp__gongrzhe-server-gmail-autoauth-mcp__draft_email({
"to": ["executive-team@company.com"],
"subject": "AI Pulse Issue #1 - Passive Investing's $13T Cognitive Labor Blind Spot",
"body": "[complete HTML content]",
"mimeType": "text/html"
})
Error Handling¶
- If HTML file is missing: Request user to generate newsletter first
- If MCP server fails: Provide error details and suggest retry
- If subject line exceeds limits: Automatically truncate while preserving key information
- If recipients not specified: Ask user for recipient list
Quality Checklist¶
- HTML content converted to inline CSS (no
<style>tags) - All background colors and gradients properly inlined
- Text colors and typography styles applied inline
- Subject line is professional and under 60 characters
- Recipients list is appropriate for content sensitivity
- MimeType is set to "text/html" for proper rendering
- All links in HTML are clean URLs (no .md extensions)
- Draft creation confirmed successful
Notes¶
- These instructions work with any newsletter HTML generated using the template system
- Subject line format can be customized per organization needs
- Recipients can be configured for different distribution lists
- Always create draft first - never send directly without user review