Write in Notion. Send as email.
Give it a Notion page ID, get back email HTML that works in Gmail, Outlook, and Apple Mail.
import { renderFromNotion } from 'notion-to-email'
const { html, title } = await renderFromNotion({
pageId: 'your-page-id',
token: 'your-notion-token',
})
// Pass html to SES, SendGrid, Nodemailer, etc.npm install notion-to-email @notionhq/client@notionhq/client is a peer dependency. Requires Node 18+.
import { renderFromNotion } from 'notion-to-email'
const result = await renderFromNotion({
pageId: 'your-page-id',
token: 'your-notion-token',
})
result.html // Full HTML email document
result.title // Page title
result.icon // Page icon (emoji or URL)
result.url // Notion page URL# Output HTML to stdout
npx notion-to-email <page-id> --token secret_xxx
# Save to file
npx notion-to-email <page-id> -o email.html
# Use environment variable
export NOTION_TOKEN=secret_xxx
npx notion-to-email <page-id>
# Notion URL works too
npx notion-to-email https://notion.so/My-Page-abc123claude plugin add https://github.com/Sangkwun/notion-to-email
# Then in Claude Code:
/notion-to-email <page-id>await renderFromNotion({
pageId: 'your-page-id',
token: 'your-token',
options: {
// Proxy private page images through your own CDN
resolveImageUrl: (url, context) => {
// context: { blockId, blockType, pageId, isPublicPage, usage }
return `https://your-cdn.com/proxy?url=${encodeURIComponent(url)}`
},
header: {
showNotionButton: true, // Show "View on Notion" button (default: true)
notionButtonLabel: 'Open in Notion',
},
footer: '<p>Sent via My App</p>', // HTML string, or false to disable
// 'hide' | 'placeholder' | ((blockType) => string)
onUnsupportedBlock: 'placeholder',
labels: {
viewOnNotion: 'View on Notion',
unsupportedBlock: 'View on Notion',
},
},
})When you need control over the fetch process — for example, to upload images to your own storage before rendering:
import { renderNotionEmail } from 'notion-to-email'
import type { ExtraData } from 'notion-to-email'
const html = renderNotionEmail(page, children, extraData, options)| Block Type | Status |
|---|---|
| Paragraph | ✅ |
| Heading 1–4 | ✅ |
| Bulleted / Numbered List | ✅ |
| To-Do | ✅ |
| Toggle | ✅ |
| Quote | ✅ |
| Callout | ✅ |
| Divider | ✅ |
| Code | ✅ |
| Equation | ✅ |
| Image | ✅ |
| Video (YouTube) | ✅ |
| File | ✅ |
| Bookmark | ✅ |
| Table | ✅ |
| Column List | ✅ |
| Child Page | ✅ |
| Child Database | ✅ |
| Synced Block | ✅ |
| Link to Page | ✅ |
| Table of Contents | ✅ |
Rich text: bold, italic, strikethrough, code, underline, colors, links, mentions
MIT
