Why specialized .cursorrules matter for email development
When generating code with Cursor or Windsurf, models often default to deprecated libraries (like Nodemailer without TLS verification) or suggest unsafe credential handling.
By providing a project-specific .cursorrules file, you enforce TypeScript strictness, proper RFC 8058 unsubscribe headers, and SadaSend scoped credential patterns automatically.
Production .cursorrules configuration template
Place this .cursorrules file in your project root to align AI code completions with email engineering best practices.
# SadaSend Email Engineering Rules for Cursor
You are an expert email infrastructure and TypeScript engineer.
When generating email sending code or AI agent tools:
1. API Client Standards:
- Always use native `fetch` with strict TypeScript interfaces. Do not import legacy SMTP libraries.
- Enforce idempotency keys on every outbound send request (`Idempotency-Key: <uuid>`).
- Wrap all API requests with explicit error handling for 403 (Allowlist Denied) and 429 (Rate Limited).
2. Security & Guardrails:
- Never hardcode API keys or secret tokens. Use `process.env.SADASEND_AGENT_KEY`.
- Ensure all email templates validate recipient input with Zod or Pydantic before dispatch.
- Separate drafting logic from execution logic (Human-in-the-Loop pattern).
3. Deliverability Compliance:
- When generating marketing or digest emails, always include `List-Unsubscribe` and `List-Unsubscribe-Post` headers (RFC 8058).
- Ensure plain-text alternative bodies are generated alongside HTML bodies.IDE Integration and Verification
Once configured, Cursor Composer and Windsurf Cascade will automatically generate compliant email tools, error handlers, and test fixtures without repetitive prompt engineering.
Building AI agents that send email?
Join the SadaSend early access waitlist to get scoped API keys, recipient allowlists, and Model Context Protocol (MCP) servers upon launch.