8
n8n 中文网amn8n.com

个性化邮件营销活动自动化

高级

这是一个Social Media领域的自动化工作流,包含 21 个节点。主要使用 Set, Wait, Merge, Filter, EmailSend 等节点。 使用Google文档、表格和SMTP自动化个性化邮件营销活动

前置要求
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "e2b72466a589dd1250fc94a8e861457e040bf25b07f6b069958c036d3f2bfe77",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "3cc80b37-988e-4111-b9b4-8712a31fe400",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -2320,
        -16
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "seconds"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "f93e671e-f82d-453c-a734-fb144af0c090",
      "name": "联系人",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1872,
        80
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1877973285,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1VPUd7xbigvW4dIjyvsSRn3Y3jpITjyZneCIEU0HK_Hw/edit#gid=1877973285",
          "cachedResultName": "contacts"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.googlesheetid }}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "0xG6VARJ6hnHx2T1",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.4
    },
    {
      "id": "bed36d9b-defc-46ce-a6cc-aa8efdddfcc4",
      "name": "模板",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        -1760,
        -96
      ],
      "parameters": {
        "operation": "get",
        "documentURL": "={{ $json.googledocid }}"
      },
      "credentials": {
        "googleDocsOAuth2Api": {
          "id": "AJLDYa47u6QrM9Y1",
          "name": "Google Docs account"
        }
      },
      "executeOnce": true,
      "typeVersion": 2
    },
    {
      "id": "2fb0d6e9-2692-4c4d-b6a7-4d27ba467ef2",
      "name": "更新正文",
      "type": "n8n-nodes-base.set",
      "position": [
        -1184,
        -16
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "e9ac9b39-f81e-4754-b978-bb8126c2c846",
              "name": "email",
              "type": "string",
              "value": "={{ $json.email }}"
            },
            {
              "id": "c9f391a2-4017-40f3-9222-cfd79135ecfd",
              "name": "template",
              "type": "string",
              "value": "={{ $json.content\n.replaceAll(/\\{\\{ ?email ?\\}\\}/gm, $json[\"email\"])\n.replaceAll(/\\{\\{ ?company ?\\}\\}/gm, $json[\"company\"])\n.replaceAll(/\\{\\{ ?firstname ?\\}\\}/gm, $json[\"firstname\"])\n.replaceAll(/\\{\\{ ?lastname ?\\}\\}/gm, $json[\"lastname\"]); }}\n\n\n"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "4453d3d8-65d3-4b5c-8083-9c686be44678",
      "name": "设置",
      "type": "n8n-nodes-base.set",
      "position": [
        -2096,
        -16
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "0cc310e3-f3bb-4347-9d4f-275c00f0f9ac",
              "name": "emailsubject",
              "type": "string",
              "value": "Emailing Template - Email Subject"
            },
            {
              "id": "c17d8bb6-c29f-48c6-830f-acd350617810",
              "name": "googledocid",
              "type": "string",
              "value": "enter_your_googledocID_here"
            },
            {
              "id": "4b74909d-6a40-422f-9d5a-1d72f5577f3f",
              "name": "googlesheetid",
              "type": "string",
              "value": "enter_your_googlesheetID_here"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "806753db-3de0-41e2-b43b-aca9dc5f548c",
      "name": "发送邮件",
      "type": "n8n-nodes-base.emailSend",
      "notes": "OVHCloud",
      "position": [
        -720,
        0
      ],
      "webhookId": "1d3876d2-b949-4d12-8c6c-029d3bad040c",
      "parameters": {
        "text": "={{ $json.template }}",
        "options": {
          "appendAttribution": false
        },
        "subject": "={{ $('settings').item.json.emailsubject }}",
        "toEmail": "={{ $json.email }}",
        "fromEmail": "myfirstname / mycompany<myemail@mydomain.com>",
        "emailFormat": "text"
      },
      "credentials": {
        "smtp": {
          "id": "vFD0Eneal4Fwnwp3",
          "name": "SMTP account"
        }
      },
      "notesInFlow": true,
      "typeVersion": 2.1
    },
    {
      "id": "bd58504e-6a1e-46fd-b892-03853b0ab89b",
      "name": "未发送邮件",
      "type": "n8n-nodes-base.filter",
      "position": [
        -1648,
        80
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "4b68ad20-a8f8-4d5c-91fe-d4009455bcb3",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json.process }}",
              "rightValue": ""
            },
            {
              "id": "fc31006b-9dbe-43a9-ae8a-5389b8379f34",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json.err }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "fe137938-de01-4542-bbe1-7d605c4ca372",
      "name": "更新联系人",
      "type": "n8n-nodes-base.googleSheets",
      "notes": "row_number (using to match)\n{{ $('contacts').item.json.row_number }}\n\nprocess\n{{ $now.format('yyyy-MM-dd, hh:mm:ss a') }}",
      "position": [
        -496,
        0
      ],
      "parameters": {
        "columns": {
          "value": {
            "process": "={{ $now.format('yyyy-MM-dd, hh:mm:ss a') }}",
            "row_number": "={{ $('contacts').item.json.row_number }}"
          },
          "schema": [
            {
              "id": "email",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "firstname",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "firstname",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "lastname",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "lastname",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "company",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "company",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "process",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "process",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "err",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "err",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "row_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "contacts"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('settings').item.json.googlesheetid }}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "0xG6VARJ6hnHx2T1",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.4
    },
    {
      "id": "10b636a0-63b8-4215-956f-d66606ae51eb",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -960,
        -16
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "c1a3e48d-3447-400f-a366-447fb126fb08",
      "name": "等待",
      "type": "n8n-nodes-base.wait",
      "position": [
        -272,
        80
      ],
      "webhookId": "8951d24d-d855-43ce-8746-2758c898ed72",
      "parameters": {
        "amount": 20
      },
      "typeVersion": 1.1
    },
    {
      "id": "463a82ed-2515-4e29-98c8-a091ec62abdf",
      "name": "无操作,不执行任何操作",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -736,
        -208
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "bc87d9fe-f2d8-4488-b513-9d54d45b989f",
      "name": "合并",
      "type": "n8n-nodes-base.merge",
      "position": [
        -1424,
        -16
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineAll"
      },
      "typeVersion": 3
    },
    {
      "id": "706fec26-39d6-4517-849c-bd7ff52c735e",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -304,
        272
      ],
      "parameters": {
        "color": 7,
        "width": 176,
        "height": 188,
        "content": "SMTP 提供商(如 OVHcloud)有配额限制。"
      },
      "typeVersion": 1
    },
    {
      "id": "982f0c8d-1cf1-49bf-9a93-0076312c8747",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -528,
        272
      ],
      "parameters": {
        "color": 7,
        "width": 192,
        "height": 188,
        "content": "*row_number* 用于匹配,应包含 {{ $('contacts').item.json.row_number }}"
      },
      "typeVersion": 1
    },
    {
      "id": "ed4175e8-5d53-4520-83dc-83f098b4678b",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -752,
        272
      ],
      "parameters": {
        "color": 7,
        "width": 192,
        "height": 188,
        "content": "更新为您自己的 SMTP 详细信息并调整\"发件人邮箱\"字段"
      },
      "typeVersion": 1
    },
    {
      "id": "ac803816-b96d-4d3f-b5e9-ab90c0f6f361",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1232,
        -96
      ],
      "parameters": {
        "color": 7,
        "width": 208,
        "height": 444,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "1aa209a1-6e65-43e8-a8e3-bb5f539b6702",
      "name": "便签 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1696,
        208
      ],
      "parameters": {
        "color": 7,
        "width": 192,
        "height": 144,
        "content": "我们仅选择 *process* 和 *err* 列为空的行"
      },
      "typeVersion": 1
    },
    {
      "id": "6b7d9070-e448-437c-9ae0-e52b2a18dcd0",
      "name": "便签 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1808,
        -352
      ],
      "parameters": {
        "color": 7,
        "width": 192,
        "height": 412,
        "content": "您的 Google Docs 模板,包含带有以下变量的消息:"
      },
      "typeVersion": 1
    },
    {
      "id": "93ed8856-43da-447c-a85b-a24553468361",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2128,
        160
      ],
      "parameters": {
        "color": 7,
        "width": 192,
        "height": 192,
        "content": "设置您的邮件营销活动主题,定义要使用的 Google Docs 和 Sheet ID"
      },
      "typeVersion": 1
    },
    {
      "id": "1213bc1e-1ce4-4ec0-af5e-53875f2684d9",
      "name": "便签提示",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1920,
        272
      ],
      "parameters": {
        "color": 7,
        "width": 192,
        "height": 80,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "87eddad8-8c0a-41a0-8f5d-1d2d323382ee",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2368,
        400
      ],
      "parameters": {
        "color": 7,
        "width": 1376,
        "height": 288,
        "content": "# 使用 Google Sheet、Google Docs 和 SMTP 进行邮件发送"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "merge": {
      "main": [
        [
          {
            "node": "updatebody",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "contacts": {
      "main": [
        [
          {
            "node": "notemailed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "settings": {
      "main": [
        [
          {
            "node": "template",
            "type": "main",
            "index": 0
          },
          {
            "node": "contacts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "template": {
      "main": [
        [
          {
            "node": "merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "sendemail": {
      "main": [
        [
          {
            "node": "updatecontacts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "notemailed": {
      "main": [
        [
          {
            "node": "merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "updatebody": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "updatecontacts": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "sendemail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 社交媒体

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量21
分类1
节点类型11
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Stéphane Heckel

Stéphane Heckel

@stephaneheckel

Data Sommelier | Sales Architect | Advisor | GTM

外部链接
在 n8n.io 查看

分享此工作流