← Back to directory
Personal Productivity Medium to set up AI workflow Draft Response

Email Management: Auto-Delete Marketing & AI Replies

Source reviewed Updated 2026-07-07

Automatically deletes marketing emails while logging them to Google Sheets and drafts AI replies for genuine messages.

founders and execsfreelancers and consultantsops and IT teams

What it does

You instantly clear your inbox of marketing spam by having the agent delete those emails while logging them in Google Sheets for your records. For genuine messages that need a response, you get polite AI-drafted replies ready to send without lifting a finger.

Step by step

  1. Configure the IMAP node to connect to the email provider and set a filter for unread messages only.
  2. Set up the Google Sheets node with columns for timestamp, sender, subject, classification result, and action taken.
  3. Create an IF switch node that routes based on the AI's classification output (e.g., 'marketing' vs 'personal').
  4. Configure the Gmail delete node to target specific message IDs when the marketing flag is true.

Where the LLM does the work

  • Prompt Google Gemini to analyze email content and return a structured JSON object indicating whether it is marketing spam or genuine.
  • Generate polite, context-aware reply drafts for non-marketing emails using the sender's name and original subject line.
  • Refine the AI prompt to ensure it ignores standard newsletter footers and focuses on the core message intent.

Watch out for

AI classification errors can delete important emails so always verify confidence scores or add a manual review step for low-confidence results.
Sensitive data exposure risks arise if PII is sent to external AI models so mask personal identifiers in the prompt payload before sending.

Tools that fit

n8n Service Workflow orchestration and automation logic
Gmail Service Reading, deleting, and replying to emails
Google Gemini LLM Classifying email type and generating replies
Google Sheets Service Logging deleted and replied emails for auditing

The agent brief

Everything your agent needs, including the gotchas. Copy it and go.
agent-brief.md
You are helping me build the following AI agent workflow.

## Goal
Email Management: Auto-Delete Marketing & AI Replies: Automatically deletes marketing emails while logging them to Google Sheets and drafts AI replies for genuine messages.

## Specification
- What it does: You instantly clear your inbox of marketing spam by having the agent delete those emails while logging them in Google Sheets for your records. For genuine messages that need a response, you get polite AI-drafted replies ready to send without lifting a finger.
- Trigger: Triggered by an event (Event · on new email via IMAP)
- Autonomy: Fully hands-off
- Expected setup effort: about an afternoon
- Tools/services involved:
  - n8n: Workflow orchestration and automation logic
  - Gmail: Reading, deleting, and replying to emails
  - Google Gemini: Classifying email type and generating replies
  - Google Sheets: Logging deleted and replied emails for auditing

## Known pitfalls, handle each one explicitly in your implementation
1. AI classification errors can delete important emails so always verify confidence scores or add a manual review step for low-confidence results.
2. Sensitive data exposure risks arise if PII is sent to external AI models so mask personal identifiers in the prompt payload before sending.

## Reference implementation
https://n8n.io/workflows/7551 (workflow template)
Fetch and inspect this before building. If it matches my stack, adapt it;
if not, rebuild the pattern with my tools.

## Process requirements
1. Before building: ask me which of the listed tools I actually use and
   what my platform is (n8n / Make / code / other). Do not assume.
2. Adapt the pattern to my answers; do not force the reference stack.
3. Address every pitfall above; tell me how you handled each.
4. Provide a test plan I can run before letting this touch real data.
5. Ask before any step that sends messages, modifies data, or spends money.

Source: https://usecasesforagents.com/use-case/email-management-auto-delete-marketing-ai-replies/ via usecasesforagents.com

Frequently asked questions

Can I use a different Automation Platform than n8n?

Yes. n8n is only the example automation platform in this recipe. The same flow works with Home Assistant. Swap the automation platform connection and keep the rest of the setup as written.

Want this running in your business?

This is what I do. I design and build AI agents like this one, and keep them running. If you want it set up for your team instead of doing it yourself, get in touch.
Get in touch →

Who it's for

Built for founders and execs who need personal productivity handled without hiring for it.

Freelancers and consultants can run this per-client with no changes beyond the source data.

Ops-IT teams triaging their own internal requests get the same pattern, different queue.

Seen in the wild

← Back to directory