{
  "name": "Email Verifier from CSV",
  "nodes": [
    {
      "parameters": {
        "amount": 2,
        "unit": "ms"
      },
      "id": "8b457fc3-186a-4960-b4e1-a008ddc1c86a",
      "name": "Rate Limit Delay",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1,
      "position": [
        1184,
        -48
      ]
    },
    {
      "parameters": {
        "url": "https://api.mails.so/v1/validate",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "email",
              "value": "={{ $json.email }}"
            }
          ]
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "x-mails-api-key",
              "value": "7ee9b40b-090a-4e75-89e1-d91b22519080"
            }
          ]
        },
        "options": {}
      },
      "id": "f6290de0-f716-470d-8b4c-d04783251a2c",
      "name": "Verify Email",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [
        1408,
        -48
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "77d4b2db-9f25-48b6-bba9-06f003416571",
      "name": "Format Results",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3,
      "position": [
        1632,
        -48
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "56fa8abe-1c53-469d-a0b7-940eaa701f92",
      "name": "Generate Results CSV",
      "type": "n8n-nodes-base.convertToFile",
      "typeVersion": 1,
      "position": [
        1856,
        -48
      ]
    },
    {
      "parameters": {
        "fromEmail": "maroontree74@gmail.com ",
        "toEmail": "maroontree74@gmail.com ",
        "subject": "Verified Emails ",
        "emailFormat": "text",
        "text": "=Here are your email verification results:\n",
        "options": {
          "attachments": "attachment"
        }
      },
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "position": [
        2304,
        -48
      ],
      "id": "c71af4b9-1c04-45c5-8c2b-9f99087e85c5",
      "name": "Send email",
      "credentials": {
        "smtp": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        368,
        -48
      ],
      "id": "566feccb-38cc-41f1-bfb1-fd8d11b57d1b",
      "name": "When clicking \u2018Execute workflow\u2019"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.readWriteFile",
      "typeVersion": 1,
      "position": [
        560,
        -48
      ],
      "id": "2cbabee9-64c6-46e0-9dfe-4fafbe122e79",
      "name": "Read/Write Files from Disk"
    },
    {
      "parameters": {
        "jsCode": "// Parse CSV (binary or text)\nlet csvString = '';\nif (items[0].binary && items[0].binary.data) {\n  csvString = Buffer.from(items[0].binary.data.data, 'base64').toString('utf8');\n} else if (items[0].json.csv_text) {\n  csvString = items[0].json.csv_text;\n} else {\n  throw new Error('No CSV found');\n}\nconst lines = csvString.split('\\n').filter(l => l.trim() !== '');\nconst headers = lines.shift().split(',');\nreturn lines.map(line => {\n  const cols = line.split(',');\n  const obj = {};\n  headers.forEach((h, i) => obj[h.trim()] = (cols[i] || '').trim());\n  return { json: obj };\n});"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        736,
        -48
      ],
      "id": "f45b738c-f7de-4be3-ae3e-cf702ffd520e",
      "name": "Parse CSV"
    },
    {
      "parameters": {
        "jsCode": "// Extract only emails from the input data\nconst result = [];\n\nfor (const item of $input.all()) {\n  // Check if the item has an 'Emails' field and it's not empty\n  if (item.json.Emails && item.json.Emails.trim() !== '') {\n    result.push({\n      email: item.json.Emails.trim()\n    });\n  }\n}\n\n// Return only items that have emails\nreturn result;\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        960,
        -48
      ],
      "id": "23561b40-6dc8-4463-bbcd-30c1c8d25f38",
      "name": "Format E-Mails"
    },
    {
      "parameters": {
        "jsCode": "// Convert CSV binary to proper attachment for Send Email node\nconst csvBinaryKey = 'data'; // binary key from Convert to CSV node\n\nreturn [\n  {\n    json: {\n      // optional: text in email body\n      text: 'Here is the verified email CSV',\n    },\n    binary: {\n      attachment: {\n        // just copy the binary from previous node\n        data: items[0].binary[csvBinaryKey].data,\n        mimeType: 'text/csv',\n        fileName: 'verified_emails.csv'\n      }\n    }\n  }\n];\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        2080,
        -48
      ],
      "id": "345adee6-0480-46a6-ba0d-c98d5eef8e5f",
      "name": "Ready Files for E-Mail"
    }
  ],
  "connections": {
    "Rate Limit Delay": {
      "main": [
        [
          {
            "node": "Verify Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Verify Email": {
      "main": [
        [
          {
            "node": "Format Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Results": {
      "main": [
        [
          {
            "node": "Generate Results CSV",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Results CSV": {
      "main": [
        [
          {
            "node": "Ready Files for E-Mail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Read/Write Files from Disk",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read/Write Files from Disk": {
      "main": [
        [
          {
            "node": "Parse CSV",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse CSV": {
      "main": [
        [
          {
            "node": "Format E-Mails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format E-Mails": {
      "main": [
        [
          {
            "node": "Rate Limit Delay",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ready Files for E-Mail": {
      "main": [
        [
          {
            "node": "Send email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "a73e922f-5478-4c14-b39c-6eeff3dee549",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "ejNVIzVTDA6lRRFH",
  "tags": []
}