Templates / Send staged invoice payment reminders with Microsoft SQL and Gmail

Send staged invoice payment reminders with Microsoft SQL and Gmail

Ready for 3.0

by Prakash Software ✓ · 52 views · created 2026-07-02 · Invoice Processing

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.

Nodes used (11)

Microsoft SQLGmail

What it does

Quick Overview This workflow runs daily at 9 AM to pull unpaid invoices from Microsoft SQL, send staged payment reminder emails via Gmail based on due date timing, update invoice status and an audit log in the database, and email an HTML summary report to the finance team. How it works 1. Runs every day at 9 AM on a schedule. 2. Queries a Microsoft SQL database for invoices with PaymentStatus = 'Unpaid' and checks whether any results are returned. 3. For each unpaid invoice, calculates the number of days until the due date and routes it to the matching reminder window (7 days before, 3 days before, due today, 1 day overdue, 7 days overdue, or 15 days overdue). 4. For invoices in each window, checks the current ReminderStage, composes the appropriate email content, and sends the reminder to the customer via Gmail. 5. After each email is sent, updates the invoice record with the new ReminderStage and LastReminderDate and inserts a REMINDERSENT entry into a Microsoft SQL AuditLog table. 6. Merges all reminder results, aggregates them into a single list, generates an HTML summary report, and emails it to the finance address via Gmail. Setup 1. Create or confirm a Microsoft SQL database schema with an Invoices table containing the fields used in the query and updates (including PaymentStatus, DueDate, ReminderStage, and LastReminderDate) and an AuditLog table for inserts. 2. Add Microsoft SQL credentials in n8n and verify the connection details match the server hosting your Invoices and AuditLog tables. 3. Add Gmail OAuth2 credentials in n8n with permission to send mail from the account used for customer reminders and finance summaries. 4. Update the finance summary recipient email address in the final Gmail step and adjust the SQL queries and reminder email templates to match your invoice identifiers, currency, and business wording.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.