AutomationFlowsEmail & Gmail › Send Emails via Gmail & Supabase

Send Emails via Gmail & Supabase

Original n8n title: Send Emails

Send-Emails. Uses gmail, supabase, httpRequest. Event-driven trigger; 11 nodes.

Event trigger★★★★☆ complexity11 nodesGmailSupabaseHTTP Request
Email & Gmail Trigger: Event Nodes: 11 Complexity: ★★★★☆ Added:

This workflow follows the Gmail → HTTP Request recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "nodes": [
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        656,
        128
      ],
      "id": "fdcfda3b-4709-40f0-b7a2-26e6410797ba",
      "name": "When clicking \u2018Execute workflow\u2019"
    },
    {
      "parameters": {
        "sendTo": "={{ $json.decision_maker_email }}",
        "subject": "={{ $('Get Email Template').first().json.subject }}",
        "message": "={{ $('Format the Template').first().json.emailHtml }}<br><br>\n<a href=\"https://n8n.elyptra.com/webhook/unsubscribe?optOutCode={{ $json.opt_out_code }}\">Click Here to Unsubscribe</a>",
        "options": {
          "appendAttribution": false,
          "senderName": "Lyndon S.",
          "replyToSenderOnly": true
        }
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        1616,
        32
      ],
      "id": "6875112e-0034-4254-a430-82ea99a56d81",
      "name": "Send a message",
      "retryOnFail": true,
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "tableId": "email_logs",
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldId": "property_id",
              "fieldValue": "={{ $('Loop Over Items').item.json.id }}"
            },
            {
              "fieldId": "template_id",
              "fieldValue": "={{ $('Get Email Template').first().json.id }}"
            },
            {
              "fieldId": "campaign_day",
              "fieldValue": "={{ $('Get Email Template').first().json.current_day }}"
            },
            {
              "fieldId": "email_id",
              "fieldValue": "={{ $json.id }}"
            },
            {
              "fieldId": "thread_id",
              "fieldValue": "={{ $json.threadId }}"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        1792,
        32
      ],
      "id": "2fce5651-11e9-4bd9-8f8f-f170dc8be998",
      "name": "Log",
      "retryOnFail": true,
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      },
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "url": "https://wiwxjzggfwkiqekkjtev.supabase.co/rest/v1/rpc/get_current_email_template",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "supabaseApi",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        832,
        16
      ],
      "id": "efe0cb04-d716-4631-bc2c-42f72995ec3e",
      "name": "Get Email Template",
      "alwaysOutputData": false,
      "retryOnFail": true,
      "notesInFlow": false,
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "batchSize": 10,
        "options": {}
      },
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        1392,
        16
      ],
      "id": "7cb79ddd-3766-48e4-bad4-4451434565f2",
      "name": "Loop Over Items"
    },
    {
      "parameters": {
        "content": "# \u2709 Email Campaign Automation\n\n## Features\n- Sends emails from pre-created templates to property managers via Gmail\n- Batch processing (10 emails at a time)\n- Campaign week tracking & auto-increment\n- Activity logging with email/thread IDs\n- Respects suspension dates\n\n## Function Flow\n1. Get current email template from Supabase\n2. Format HTML email content\n3. Fetch active properties (suspend_until \u2264 today)\n4. Loop through properties in batches\n5. Send Gmail \u2192 Log activity \u2192 Update campaign progress\n\n## Setup Requirements\n**Credentials:**\n- Gmail OAuth2 (for sending)\n- Supabase API (for database)\n\n**Database Tables:**\n- `email_templates` - campaign content\n- `properties` - owner contact info\n- `email_logs` - delivery tracking\n- `campaign_progress` - week counter\n\n## Key Settings\n- **Batch Size**: 10 properties per loop\n- **Sender Name**: \"Lyndon S.\"\n- **Reply-to**: Sender only\n- **Error Handling**: Continue on failure\n- **Retry**: Enabled on all nodes\n",
        "height": 880,
        "width": 2032,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        144,
        -304
      ],
      "id": "b387eb06-a61f-4725-b921-04cf1ca577bd",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "amount": 30
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        1968,
        32
      ],
      "id": "93c2b431-f473-46f3-bd4e-3bf93bd267c9",
      "name": "Wait"
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        656,
        -80
      ],
      "id": "da622108-2766-44bb-b35f-b5fadd154c1d",
      "name": "Schedule Trigger"
    },
    {
      "parameters": {
        "operation": "getAll",
        "tableId": "properties",
        "returnAll": true,
        "matchType": "allFilters",
        "filters": {
          "conditions": [
            {
              "keyName": "decision_maker_email",
              "condition": "=not.is",
              "keyValue": "null"
            },
            {
              "keyName": "decision_maker_email",
              "condition": "neq"
            },
            {
              "keyName": "decision_maker_email",
              "condition": "like",
              "keyValue": "%@%"
            },
            {
              "keyName": "suspend_until",
              "condition": "lte",
              "keyValue": "={{ new Date().toISOString().split('T')[0] }}"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        1216,
        16
      ],
      "id": "f7183e15-ff21-430d-b3b3-b13d3ac86f77",
      "name": "Get Emails",
      "retryOnFail": true,
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://wiwxjzggfwkiqekkjtev.supabase.co/rest/v1/rpc/increment_campaign_day",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "supabaseApi",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1616,
        -192
      ],
      "id": "3986e8f5-cd19-4867-a2e6-3aceefa54f7b",
      "name": "Update Email Template",
      "alwaysOutputData": false,
      "retryOnFail": true,
      "notesInFlow": false,
      "executeOnce": true,
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      },
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "jsCode": "// Get input data from the previous node\nconst items = $input.all();\nif (!items || items.length === 0) {\n  throw new Error('No input data received');\n}\n\n// Access the first item's json property\nconst inputData = items[0].json;\n\n// Destructure fields from inputData, providing defaults\nconst { hook = '', body = '', signature = '' } = inputData;\n\n// Format the signature, converting \\n and \\\\n to <br>\nconst formattedSignature = (signature || '')\n  .replace(/\\\\n/g, '<br>')\n  .replace(/\\n/g, '<br>');\n\n// Build the HTML email body\nlet emailHtml = '';\n\nif (hook) {\n  emailHtml += `<p style=\"font-weight:bold; font-size:1.1em; margin-bottom:12px;\">${hook}</p>`;\n}\n\nemailHtml += `<p style=\"margin-bottom:18px; font-size:1.05em;\">${body}</p>`;\n\nemailHtml += `<p style=\"color:#444; font-size:0.98em; white-space:pre-line; margin-top:24px;\">${formattedSignature}</p>`;\n\nreturn [{\n  json: {\n    emailHtml,\n  }\n}];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1024,
        16
      ],
      "id": "41162cc7-8c1e-46fb-8097-bb208726eb49",
      "name": "Format the Template",
      "retryOnFail": true
    }
  ],
  "connections": {
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Get Email Template",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a message": {
      "main": [
        [
          {
            "node": "Log",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Email Template": {
      "main": [
        [
          {
            "node": "Format the Template",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Update Email Template",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get Email Template",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Emails": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format the Template": {
      "main": [
        [
          {
            "node": "Get Emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "meta": {
    "templateCredsSetupCompleted": true
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Send-Emails. Uses gmail, supabase, httpRequest. Event-driven trigger; 11 nodes.

Source: https://github.com/anas-farooq8/Realestate-Outreach/blob/main/workflows/Send-Emails.json — original creator credit. Request a take-down →

More Email & Gmail workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Email & Gmail

Monitor-Emails. Uses gmailTrigger, gmail, supabase, httpRequest. Event-driven trigger; 12 nodes.

Gmail Trigger, Gmail, Supabase +1
Email & Gmail

This workflow is built for agencies, freelancers, and local service businesses who want to automate prospecting. If you sell services to local businesses -- web design, SEO, bookkeeping, HVAC -- this

HTTP Request, Gmail
Email & Gmail

This workflow is a powerful, two-phase system designed to automate the entire passive candidate sourcing and engagement cycle.

HTTP Request, Google Sheets, Gmail
Email & Gmail

How It Works Starts with a Manual Trigger Reads lead list from Google Sheet Filter rows where email wasn’t sent Generate personalized email body (AI) Generate email subject line (AI) Merge AI outputs

Google Sheets, HTTP Request, Gmail
Email & Gmail

Hunter Form. Uses stickyNote, formTrigger, noOp, httpRequest. Event-driven trigger; 15 nodes.

Form Trigger, HTTP Request, Hunter +2