# Drafted-email output validator

> Template · Section 12 from *The GTM Engineering Handbook* by Jared Waxman (GTM Engineer School).  
> Web version: https://gtm-engineer-school.com/resources/gtme-handbook/templates/email-output-validator/  
> Last updated: 2026-11-28  
> © 2026 Jared Waxman. All rights reserved. Short quotations with attribution and a link are welcome.

## Drafted-email output validator

*From Section 12.*

A short Python check that runs on a drafted email before a human sees it. Illustrative, not a complete production service.

`extract_company_names` is left for you to implement. Banned phrases and the word limit are examples; replace them with your own standards.

```python
BANNED = ["i hope this finds you well", "revolutionize", "synergy",
          "as an ai", "unlock", "game-changer"]

def validate_email(draft, record, approved_proof_points, max_words=90):
    body = draft["body"].lower()
    errors = []
    if len(draft["body"].split()) > max_words:
        errors.append("too_long")
    if any(b in body for b in BANNED):
        errors.append("banned_phrase")
    if record["first_name"].lower() not in body and record["company"].lower() not in body:
        errors.append("no_recipient_reference")
    for name in extract_company_names(draft["body"]):
        if name not in (record["company"], *approved_proof_points["customers"]):
            errors.append(f"unapproved_company_mention:{name}")
    if "{{" in draft["body"] or "}}" in draft["body"]:
        errors.append("unfilled_template_variable")
    return errors
```

---

All concepts: [concepts.md](https://gtm-engineer-school.com/resources/gtme-handbook/concepts.md) · Practitioner questions: [questions.md](https://gtm-engineer-school.com/resources/gtme-handbook/questions.md) · All chapters: [llms.txt](https://gtm-engineer-school.com/resources/gtme-handbook/llms.txt)
