agentleFS
fabioc-alohafabioc-aloha/Alex_ACT_Edition/.github/skills/md-to-eml/SKILL.md

md-to-eml

Skill0 starsChanged 4 months agoMITView on GitHub

Convert Markdown to RFC 5322 email (.eml) with inline CSS and CID images

1 other project uses a version of this, 1 of them edited.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Not earning tokens if users must manually fix the same MIME issues on every conversion

    line 224

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Md To Eml

Write in Markdown, send as professional email — works in any email client

Convert Markdown documents with YAML frontmatter into RFC 5322-compliant .eml files ready for governance, newsletter, and stakeholder communication workflows.


When to Use

  • Sending formatted content via email clients (Outlook, Thunderbird, etc.)
  • Newsletter or governance communication from Markdown sources
  • Generating test emails for review before batch sending
  • Converting documentation into distributable email format
  • Creating email templates with consistent branding
  • Stakeholder updates with embedded charts or diagrams

Supported Formatting

FormatStatusNotes
Headings✅H1-H6 with inline styles
Bold/Italic✅Standard emphasis
Links✅Clickable hyperlinks
Images✅CID embedded as attachments
Code blocks✅Monospace, gray background
Inline code✅Highlighted
Tables✅HTML tables with borders
Blockquotes✅Indented with border
Lists✅Ordered and unordered
Mermaid diagrams⚠️Table fallback (no JS in email)
Emoji✅Unicode preserved
Horizontal rules✅Styled dividers

Key Features

FeatureDetails
YAML frontmatterMaps to RFC 5322 headers (To, From, Subject, CC, Reply-To)
Email-safe HTMLInline CSS with table-based layout (no <style> blocks)
Mermaid fallbackDiagrams converted to ASCII table representation (email-safe)
CID imagesLocal images embedded as base64 multipart MIME attachments
Emoji preservationSubject and body emoji render correctly across clients
Test mode--test flag overrides recipients for safe preview

Usage

# Basic conversion
node .github/skills/md-to-eml/scripts/md-to-eml.cjs newsletter.md

# With test recipient override (safe preview)
node .github/skills/md-to-eml/scripts/md-to-eml.cjs newsletter.md --test --test-to me@example.com

# Embed images as CID attachments
node .github/skills/md-to-eml/scripts/md-to-eml.cjs update.md --inline-images

# Debug mode (saves intermediate HTML)
node .github/skills/md-to-eml/scripts/md-to-eml.cjs update.md --debug

Options Reference

OptionDefaultDescription
--testoffOverride recipients for safe preview
--test-to ADDRESSfrontmatter fromCustom test recipient email
--inline-imagesoffEmbed images as base64 CID attachments
--debugoffSave intermediate HTML for inspection

Frontmatter Format

The YAML frontmatter maps directly to RFC 5322 email headers:

---
to: team@example.com
from: sender@example.com
subject: 📊 Weekly Update - Sprint 42
cc: manager@example.com
reply-to: noreply@example.com
---
FieldRFC 5322 HeaderRequiredNotes
toTo✅Primary recipient(s), comma-separated
fromFrom✅Sender address
subjectSubject✅Supports emoji
ccCc❌Carbon copy recipients
reply-toReply-To❌Reply address if different from From

Email Client Compatibility

ClientHTMLImagesTablesEmoji
Outlook (Windows)✅✅ CID✅✅
Outlook (Mac)✅✅ CID✅✅
Gmail (Web)✅✅ CID✅✅
Apple Mail✅✅ CID✅✅
Thunderbird✅✅ CID✅✅
Mobile (iOS/Android)✅⚠️ varies✅✅

Test Mode Workflow

  1. Write your newsletter/update in Markdown with frontmatter
  2. Convert with --test --test-to your@email.com
  3. Open the .eml file in your email client
  4. Review formatting, images, links
  5. Convert again without --test for production
  6. Send via your email client or automation

Mermaid Diagrams in Email

Email clients cannot execute JavaScript, so Mermaid diagrams are converted to text-based table representations:

┌─────────────────┐
│ Original Mermaid │ → Table Fallback
└─────────────────┘

flowchart LR    →   | Step | Description |
  A --> B           | A    | Start       |
  B --> C           | B    | Process     |
                    | C    | End         |

For high-fidelity diagrams, pre-render to PNG and include as images.


Troubleshooting

ProblemCauseSolution
"pandoc not found"pandoc not installedwinget install pandoc
Images not showingCID not supportedUse --inline-images flag
Formatting brokenClient strips stylesUse simpler formatting
Large file sizeToo many imagesLink images instead of embedding
Subject truncatedToo longKeep under 60 characters
Emoji not showingOld email clientUse text alternatives

Limitations

  • Email clients cannot execute JavaScript — Mermaid diagrams use table fallback
  • Complex CSS layouts may render differently across clients (Outlook vs Gmail vs Apple Mail)
  • Inline images add to email size — consider linking for large image sets
  • Some clients strip CSS — design for graceful degradation

Requirements

  • Node.js 24+
  • pandoc (for Markdown to HTML conversion)
  • Shared modules: markdown-preprocessor.cjs, mermaid-pipeline.cjs

Muscle Script

.github/skills/md-to-eml/scripts/md-to-eml.cjs (v1.0.0)


Conversion Acceptance Decision Table

ConditionVerdictAction
Subject, From, To headers present and correctAcceptRequired fields for valid .eml
Missing or malformed email headersRejectCheck frontmatter extraction
HTML body renders in Outlook/Gmail previewAcceptTest in at least one client
Body shows raw HTML tags or broken layoutRejectCheck MIME Content-Type is text/html
Inline images display (CID or base64)AcceptVerify no external URL references
Images missing or show broken iconsRejectEmbed as base64 or CID attachment
Links are clickable and point to correct URLsAcceptSpot-check 2-3 links
Mermaid diagrams pre-rendered as inline imagesAcceptRaw mermaid syntax is not email-safe
Mermaid diagrams show as code blocksRejectPre-render to PNG before embedding
File opens in default mail client without errorsAcceptTest .eml file import
Total .eml size >5MBWarningCompress images or link instead of embed
Plain-text MIME part included as fallbackAcceptRecommended for accessibility

Related Skills

  • md-to-html — Sister converter for web page output
  • md-to-word — Sister converter for Word document output
  • md-scaffold — Generate email templates with correct frontmatter
  • lint-clean-markdown — Pre-validate markdown before conversion

Skill version: 2.0.0 | Last updated: 2026-04-14 | Category: document-conversion

Falsifiability

  • This skill is wrong if generated .eml files fail to render correctly in Outlook or Thunderbird, or if MIME structure is rejected by mail servers
  • The header format is stale if RFC 5322 compliance requirements change or major mail clients alter their parsing
  • Not earning tokens if users must manually fix the same MIME issues on every conversion

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.