Postgres Smtp Email Queue That Prevents Duplicate Sends
What this workflow does
The workflow contains these steps: Run Once to Create Tables → Create Outbox Tables → Enqueue Email Webhook → Every Minute → Daily Summary at 8am → Outbox Settings → Which Trigger? → Validate Email Request → Request Valid? → Enqueue Once → Enqueue Result → Respond Queued → Respond Duplicate → Respond Address Blocked → Respond Database Unavailable → Respond Invalid Request → Mark Stuck and Blocked Emails → New Stuck Emails? → Alert Owner About Stuck Emails → Claim Due Emails → Any Emails Claimed? → Send Queued Email → Mark Email Sent → Classify SMTP Error → Record Send Failure → Count Last 24 Hours → Email Daily Summary.
What you need
- An n8n instance to import and run the workflow.
- StickyNote access for the StickyNote steps listed in this workflow.
- ManualTrigger access for the ManualTrigger steps listed in this workflow.
- Postgres access for the Postgres steps listed in this workflow.
- Webhook access for the Webhook steps listed in this workflow.
- Schedule access for the Schedule steps listed in this workflow.
- Set access for the Set steps listed in this workflow.
- Switch access for the Switch steps listed in this workflow.
- Code access for the Code steps listed in this workflow.
- IF access for the IF steps listed in this workflow.
- RespondToWebhook access for the RespondToWebhook steps listed in this workflow.
- EmailSend access for the EmailSend steps listed in this workflow.
Workflow nodes
- Run Once to Create Tables (n8n-nodes-base.manualTrigger)
- Create Outbox Tables (n8n-nodes-base.postgres)
- Enqueue Email Webhook (n8n-nodes-base.webhook)
- Every Minute (n8n-nodes-base.scheduleTrigger)
- Daily Summary at 8am (n8n-nodes-base.scheduleTrigger)
- Outbox Settings (n8n-nodes-base.set)
- Which Trigger? (n8n-nodes-base.switch)
- Validate Email Request (n8n-nodes-base.code)
- Request Valid? (n8n-nodes-base.if)
- Enqueue Once (n8n-nodes-base.postgres)
- Enqueue Result (n8n-nodes-base.switch)
- Respond Queued (n8n-nodes-base.respondToWebhook)
- Respond Duplicate (n8n-nodes-base.respondToWebhook)
- Respond Address Blocked (n8n-nodes-base.respondToWebhook)
- Respond Database Unavailable (n8n-nodes-base.respondToWebhook)
- Respond Invalid Request (n8n-nodes-base.respondToWebhook)
- Mark Stuck and Blocked Emails (n8n-nodes-base.postgres)
- New Stuck Emails? (n8n-nodes-base.if)
- Alert Owner About Stuck Emails (n8n-nodes-base.emailSend)
- Claim Due Emails (n8n-nodes-base.postgres)
- Any Emails Claimed? (n8n-nodes-base.if)
- Send Queued Email (n8n-nodes-base.emailSend)
- Mark Email Sent (n8n-nodes-base.postgres)
- Classify SMTP Error (n8n-nodes-base.code)
- Record Send Failure (n8n-nodes-base.postgres)
- Count Last 24 Hours (n8n-nodes-base.postgres)
- Email Daily Summary (n8n-nodes-base.emailSend)
Need this workflow customized or debugged? Book a 30-min scope call →
Want this set up for you? Book a 30-min scope call
I build and fix n8n workflows for agencies and SaaS teams. 30-minute scope call — bring the problem, leave with an estimate.