Home/Email API/Python email automation

Python email automation

Email automation used to mean a cron job and a template string. In 2026 it means an agent that composes, segments, and stages the send, while your Python glues the triggers.

Verified By George Hartley, Co-founder · Updated July 20, 2026

The cron-job era

The classic Python email automation is a scheduled script: query the database, format a string, loop smtplib, hope. It automates the sending and none of the thinking. The subject line is whatever you hardcoded in March.

That architecture also fails quietly: one malformed address mid-loop and the rest of the batch never sends.

Automation is an agent job now

The job changed. An agent can read your data, draft the email, build the segment, and stage the send, and Python becomes the trigger layer: fire an event, call the API, let the platform do email properly.

Python · trigger an eventPOST /v1/my/events
import requests

requests.post(
  "https://api.nitrosend.com/v1/my/events",
  headers={"Authorization": "Bearer $NITROSEND_API_KEY"},
  json={"name": "report_ready", "contact": "[email protected]"},
)

Events feed flows, flows send the mail, and a human approval gate sits in front of anything an agent stages. You're the director, not the operator.

Why flows and not a smarter cron? The revenue math: flows out-earn campaigns about thirty to one per recipient. Triggered, timed, personalised email is simply a different asset class from the batch blast your script was scheduling.

We run our own email on exactly this architecture: 99.4 percent of Nitrosend's own sends come from flows, at a 98.2 percent delivery success rate. Not a demo. The production stack, eating its own cooking.

And test the pipeline end to end, not the pieces. We once shipped a five-email onboarding sequence, flow live, contact created, everything green, and the welcome email never arrived. The smoke test caught it. Automation you haven't watched fire is automation you don't have.

Silent failures usually live in the plumbing, not the code. One agency's onboarding flow simply stopped triggering one day, and the diagnosis was a DNS change upstream, nothing in the flow at all. Watch the events, not the editor.

Full parameters and responses live in the REST API docs and the API reference.

The trap
Gmail app password
abcd efgh ijkl mnop
✕ 500 emails/day cap
✕ breaks when 2FA settings change
✕ a full-inbox credential in your code
The fix
POST /v1/messages
Authorization: Bearer ns_live_…
✓ scoped API key, revoke anytime
✓ 8,000 free sends, no daily cliff
✓ delivery events you can act on

Go deeper

Sending one-off messages instead? Start with send email with Python. Sending to a list? Read multiple recipients, because the transactional path is the wrong tool for bulk.

First send in thirty seconds.

Simple pricing. Unlimited contacts.

Every plan includes full stack emailing: Flows, Newsletter Campaigns and Transactional Email, plus our NitroWheel LLM and all agent integrations (Claude, ChatGPT, Codex, Cursor and others). Pay for what you send, not who you store.

Free
$0
forever
  • Emails 8,000then 500/mo
  • Email types Transactional & Marketing
  • AI actions 20/mo
  • Contacts Free & Unlimited
  • Brands 1
  • Seats 1
Start free
Ultra
$100
per month
  • Emails 125,000/month
  • AI actions 5,000/mo
  • Brands 5
  • Seats 10 · Domains 3
  • Frontier AI Included
  • Dedicated IP Available
Get started
Enterprise
$300
per month
  • AI actions Unlimited
  • Unlimited brands & domains Included
  • SSO / SAML Included
  • 99.9% SLA Included
Get started

Free forever. No credit card required. See full comparison →