使用Gmail发送定时RSS新闻摘要邮件
中级
这是一个Social Media领域的自动化工作流,包含 6 个节点。主要使用 Xml, Code, Gmail, HttpRequest, ScheduleTrigger 等节点。 使用Gmail发送带格式化HTML的定时RSS新闻摘要邮件
前置要求
- •Google 账号和 Gmail API 凭证
- •可能需要目标 API 的认证凭证
分类
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "a45d1jkHh90Cr2bF",
"meta": {
"instanceId": "546be790303d737c735a8648874bae91a6b66b48cd2b10cbe4cbfb78039ceb03"
},
"name": "Scheduled RSS News Digest Emails with Gmail",
"tags": [],
"nodes": [
{
"id": "544b4167-737b-4f3f-9866-457712b93b8b",
"name": "计划触发器",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-280,
320
],
"parameters": {
"rule": {
"interval": [
{}
]
}
},
"typeVersion": 1.2
},
{
"id": "24f4a95c-3009-46c5-adea-f91231dc817e",
"name": "发送消息",
"type": "n8n-nodes-base.gmail",
"position": [
600,
320
],
"webhookId": "4335f3b0-4a02-4bd7-9218-a3a064049767",
"parameters": {
"message": "=<!DOCTYPE html>\n<html lang=\"en\" >\n<head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <title>News Digest</title>\n <style>\n /* Reset */\n body, table, td, a {\n -webkit-text-size-adjust: 100%;\n -ms-text-size-adjust: 100%;\n }\n table, td {\n mso-table-lspace: 0pt;\n mso-table-rspace: 0pt;\n }\n img {\n -ms-interpolation-mode: bicubic;\n }\n body {\n margin: 0;\n padding: 0;\n font-family: \"Segoe UI\", Tahoma, Geneva, Verdana, sans-serif;\n background-color: #ffffff;\n color: #333333;\n }\n .email-container {\n max-width: 600px;\n margin: 0 auto;\n background: #ffffff;\n border-radius: 8px;\n overflow: hidden;\n box-shadow: 0 2px 8px rgba(0,0,0,0.1);\n border: 1px solid #cc0000;\n }\n .header {\n background-color: #cc0000; /* Bold red */\n color: #ffffff;\n padding: 20px 30px;\n text-align: center;\n font-size: 24px;\n font-weight: bold;\n }\n .content {\n padding: 20px 30px;\n }\n .article {\n border-bottom: 1px solid #f0f0f0;\n padding: 15px 0;\n }\n .article:last-child {\n border-bottom: none;\n }\n .title {\n font-size: 18px;\n font-weight: 600;\n color: #cc0000;\n margin: 0 0 8px 0;\n text-decoration: none;\n }\n .summary {\n font-size: 14px;\n color: #555555;\n margin: 0 0 8px 0;\n }\n .meta {\n font-size: 12px;\n color: #999999;\n }\n .footer {\n text-align: center;\n padding: 15px 30px;\n font-size: 12px;\n color: #cc0000;\n background-color: #fef0f0;\n border-top: 1px solid #cc0000;\n }\n a.button {\n display: inline-block;\n background-color: #cc0000;\n color: white !important;\n padding: 10px 15px;\n border-radius: 4px;\n text-decoration: none;\n font-weight: 600;\n margin-top: 10px;\n }\n a.button:hover {\n background-color: #990000;\n }\n a {\n color: #cc0000;\n text-decoration: none;\n }\n a:hover {\n text-decoration: underline;\n }\n @media screen and (max-width: 620px) {\n .email-container {\n width: 100% !important;\n margin: 0 auto !important;\n border-radius: 0 !important;\n }\n .header, .content, .footer {\n padding-left: 15px !important;\n padding-right: 15px !important;\n }\n .title {\n font-size: 16px !important;\n }\n }\n </style>\n</head>\n<body>\n <div class=\"email-container\" role=\"article\" aria-roledescription=\"email\" aria-label=\"News Digest\">\n <div class=\"header\">\n News RSS Feed\n </div>\n <div class=\"content\">\n <!-- Repeat this block for each article -->\n\n{{ $json.html }}\n\n\n <!-- End article block -->\n \n <!-- Add more article blocks dynamically here -->\n \n </div>\n </div>\n</body>\n</html>\n",
"options": {},
"subject": "News Digest From RSS"
},
"credentials": {
"gmailOAuth2": {
"id": "iAE1HPlKCp0c0k3Y",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "391ef1b4-63cc-4bb2-9565-f3a967d170f9",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-140,
-80
],
"parameters": {
"width": 680,
"height": 560,
"content": "Scheduled RSS News Digest Automation Workflow\n\n**Steps**\n- Schedule Trigger: Runs on a set interval.\n- HTTP Request: Fetches RSS feed from example: \"prothomalo.com\" (You can choose yours).\n- XML Node: Parses RSS XML to JSON.\n- Format Html Block (Code): Builds styled HTML email with today's date and articles (title, summary, published date, author, category, read more link).\n- Send a message (Gmail): Sends the email to using Gmail OAuth2.\n- Sticky Note: For internal comments.\n\nFlow: Schedule Trigger → HTTP Request → XML → Format Html Block → Send a message\n\nDesigned for automatic periodic news digest emails with responsive styling.\n"
},
"typeVersion": 1
},
{
"id": "7cdede22-e5e0-41fa-8b69-78d1f4cae16f",
"name": "Convert XML to JSON",
"type": "n8n-nodes-base.xml",
"position": [
160,
320
],
"parameters": {
"options": {}
},
"typeVersion": 1
},
{
"id": "05704dc2-46be-4e29-9102-4c13dc4df7a1",
"name": "Generate HTML News Preview",
"type": "n8n-nodes-base.code",
"position": [
380,
320
],
"parameters": {
"jsCode": "const entries = $input.first().json.feed.entry || [];\n\nlet html = `\n <div style=\"max-width:600px;margin:0 auto;background:#fff;padding:20px;font-family:Arial,sans-serif;color:#333;\">\n <h2 style=\"text-align:center;color:#cc0000;\">${new Date().toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' })}</h2>\n`;\n\nfor (const entry of entries) {\n const title = entry.title || 'No Title';\n const link = entry.link?.href || '#';\n const published = entry.published ? new Date(entry.published).toLocaleDateString('bn-BD', { year: 'numeric', month: 'long', day: 'numeric' }) : '';\n const author = entry.author?.name || '';\n const summary = entry.summary || '';\n const category = entry.category?.term || '';\n\n html += `\n <div style=\"border-bottom:1px solid #eee;padding:15px 0;\">\n <a href=\"${link}\" target=\"_blank\" style=\"color:#cc0000;font-size:18px;font-weight:bold;text-decoration:none;\">${title}</a>\n <p style=\"color:#555;margin:8px 0;\">${summary}</p>\n <p style=\"font-size:12px;color:#999;margin:0;\">Published: ${published} | Author: ${author} | Category: ${category}</p>\n <a href=\"${link}\" target=\"_blank\" style=\"display:inline-block;margin-top:10px;padding:8px 12px;background:#cc0000;color:#fff;text-decoration:none;border-radius:4px;\">Read More</a>\n </div>\n `;\n}\n\nreturn [{ json: { html } }];\n"
},
"typeVersion": 2
},
{
"id": "34b49597-b56b-4656-9362-129f091af80d",
"name": "Get RSS from Prothom Alo",
"type": "n8n-nodes-base.httpRequest",
"position": [
-60,
320
],
"parameters": {
"url": "https://prothomalo.com/feed",
"options": {}
},
"typeVersion": 4.2
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "301a6a15-c049-46ad-8e12-44d675855661",
"connections": {
"Schedule Trigger": {
"main": [
[
{
"node": "Get RSS from Prothom Alo",
"type": "main",
"index": 0
}
]
]
},
"Convert XML to JSON": {
"main": [
[
{
"node": "Generate HTML News Preview",
"type": "main",
"index": 0
}
]
]
},
"Get RSS from Prothom Alo": {
"main": [
[
{
"node": "Convert XML to JSON",
"type": "main",
"index": 0
}
]
]
},
"Generate HTML News Preview": {
"main": [
[
{
"node": "Send a message",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 社交媒体
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
与 XML 文件聊天
使用 GPT 和 LangChain 分析与聊天 XML 文件
Set
Xml
Code
+7
10 节点Sarfaraz Muhammad Sajib
文档提取
基于Supabase、Google表格和Gmail的自动化用户重新激活系统
使用Supabase、Google表格和Gmail的自动化用户重新激活系统
Set
Code
Gmail
+9
14 节点iamvaar
社交媒体
每日货币更新
通过CurrencyFreaks API和Gmail发送每日货币汇率更新
Set
Gmail
Http Request
+2
7 节点Sarfaraz Muhammad Sajib
加密货币交易
使用GPT 5 Nano和Google Sheets的网站SEO常见问题生成器
使用GPT 5 Nano和Google Sheets的网站SEO常见问题生成器
Set
Xml
Code
+11
35 节点Oriol Seguí
内容创作
AI生成LinkedIn帖子含人工审批
使用GPT-4、GoToHuman和Blotato的AI生成LinkedIn帖子含人工审批
Code
Merge
Filter
+10
19 节点Robert Breen
社交媒体
Arunava的多智能体智能Reddit自动化
使用AI品牌提及和Baserow跟踪自动评论Reddit帖子
If
Set
Code
+12
35 节点Arunava
社交媒体