Screening Invoice Emails for High Value Payments
- Pull all emails received in the last 12 hours.
- Filter to those whose subject/body contain payment-related keywords (see list below).
- For each match, check for attachments; open and extract text/amounts.
- Flag any email/attachment where amount ≥ $5,000, or where the content mentions "check" or "ACH" / "wire" / "routing number" / "account number".
- Produce a summary table of flagged emails for review.
Example output row:
| From | Subject | Attachment | Amount Found | Payment Method Mentioned | Flag Reason |
|------|---------|------------|---------------|---------------------------|--------------|
| vendor@acme.com | Invoice #4521 | invoice_4521.pdf | $7,250.00 | ACH | Amount ≥ $5000 + ACH details present |
Progress:
- Step 1: Retrieve inbox messages received within the last 12 hours
- Step 2: Apply keyword filter to subject + body
- Step 3: Identify attachments (PDF, DOCX, XLSX, images)
- Step 4: Extract text from attachments (OCR if image/scanned PDF)
- Step 5: Search extracted text + email body for dollar amounts
- Step 6: Compare amounts against $5,000 threshold
- Step 7: Search for payment-method keywords (check, ACH, wire, routing, account number)
- Step 8: Compile flagged list with reasons
- Step 9: Present summary; note any emails with no attachment but payment language (flag as "verify manually")
Keyword Filters
Payment/invoice trigger terms (subject or body):
invoice, payment, remittance, amount due, balance due, bill, statement, past due, wire transfer, ACH, check payment, banking details, payment instructions
Payment-method terms (for flagging method changes — high fraud risk):
ACH, routing number, account number, wire transfer, send check, mail check, updated banking information, new payment details
Amount Extraction Logic
- Scan for currency patterns:
$X,XXX.XX,USD X,XXX,Total Due: $X,XXX - Take the largest amount found in the email/attachment as the representative figure (invoices often list subtotals, tax, and total — use total/grand total/amount due, not subtotal).
- If multiple invoices are in one email thread, evaluate each separately.
Example 1:
Input: Email from "billing@supplier.com", subject "Invoice #10234 - Due in 15 days", attachment Invoice_10234.pdf containing "Total Due: $5,430.00" and "Please pay via ACH, routing #XXXXXX1234"
Output:
FLAGGED
From: billing@supplier.com
Subject: Invoice #10234 - Due in 15 days
Attachment: Invoice_10234.pdf
Amount: $5,430.00 (≥ $5,000 threshold)
Payment Method: ACH details included
Reason: High-value invoice + ACH banking info present — recommend verification call to vendor before paying
Example 2: Input: Email from "accounting@vendor2.com", subject "Payment reminder", body text only, no attachment, mentions "$1,200 outstanding, please mail check" Output:
NOT FLAGGED (below threshold)
Amount: $1,200 — below $5,000
Note: Check payment mentioned, but amount too low to require escalation. Logged for awareness only.
Example 3:
Input: Email with attachment scan0001.pdf (scanned image) mentioning "Updated banking information — please use new account for future payments" but no explicit dollar amount
Output:
FLAGGED FOR MANUAL REVIEW
Reason: No dollar amount detected, but email requests banking/payment detail changes — common fraud/BEC pattern. Escalate to AP manager regardless of amount.
- Always treat payment-method change requests as high priority, even below $5,000 — these are a common business email compromise (BEC) tactic.
- Use OCR for scanned/image-based attachments; don't skip them just because text extraction fails on the first pass.
- Cross-check sender domain against known vendor list — flag mismatched or lookalike domains separately.
- When multiple invoices appear in one attachment, sum or list them individually depending on whether they're billed together.
- Preserve original attachment file names/paths in the summary so the controller can quickly locate source documents.
- Don't rely only on subject-line keywords — many invoice emails have generic subjects like "Re: Follow up" with the real content in the attachment.
- Don't flag based on subtotal or line-item amounts — always use the final total/amount due.
- Don't ignore emails with payment-method language just because no amount is found — flag them anyway.
- Don't assume PDF text extraction always works — scanned invoices need OCR or they'll be silently skipped.
- Don't treat threshold as a hard cutoff for fraud risk — a $4,800 invoice with suspicious banking-change language still warrants a flag.