Skip to main content

Python Email Automation and Report Generator

Build a Python email automation system that generates HTML reports from data, schedules delivery, and tracks open rates.

Vul de plaatshouders in

Edit the values, then copy your finished prompt.

Jouw Prompt
prompt.txt

                                

What this prompt does

This prompt asks the AI to build a Python email automation and reporting system rather than a one-off send script. It defines seven steps: query [data_source] for [report_metrics], generate [report_format] reports with charts via [chart_library], render responsive HTML emails with Jinja2, send through [email_provider] in [batch_size] batches, schedule at [schedule], handle bounces and retries, and log every send to [log_destination] — with template inheritance for branding and a CLI for manual triggers and previews.

The structure works because it covers the full path from data to inbox, not just the send. The [report_metrics] variable defines what the report says, [chart_library] and [report_format] shape how it looks, and [batch_size] plus bounce handling make the delivery reliable at volume. Template inheritance keeps branding consistent, and the CLI preview lets you check a report before it goes out to real recipients.

When to use it

  • You need recurring branded reports delivered to clients or stakeholders on a [schedule].
  • You want charts and metrics pulled from [data_source] rendered into responsive HTML emails.
  • You're sending at volume and need batching plus bounce-and-retry handling.
  • You want every send logged to [log_destination] for auditing and debugging.
  • You need a CLI to preview a report or trigger a send manually before automating it.

Example output

Expect a complete system: a query layer pulling [report_metrics] from [data_source], a chart generator using [chart_library], Jinja2 templates with inheritance for consistent branding, a sender that batches through [email_provider] at [batch_size], a scheduler for [schedule], bounce-and-retry handling, and logging to [log_destination]. A CLI exposes manual triggers and a preview command — a runnable reporting pipeline rather than a single send function.

Pro tips

  • Always preview via the CLI before the first scheduled run — rendered HTML email often looks different from what you expect.
  • Keep [batch_size] within your [email_provider]'s rate limits (the default of 50 is conservative) to avoid throttling.
  • Be specific in [report_metrics]; vague metrics produce a report that's busy but not useful.
  • Match [chart_library] to your output — Plotly renders interactive charts, but email clients need static images, so confirm the export path.
  • Set [log_destination] to something queryable so you can answer "did this client get their report?" without guessing.
  • Test bounce handling with a known-bad address before going live, since silent bounce loss is the failure mode that erodes trust.

Frequently Asked Questions

Which email provider does it send through?
Whatever you set in `[email_provider]`, defaulting to AWS SES. Match it to your real provider so the sending API, authentication, and bounce-notification handling are generated correctly, since providers differ in how they report delivery failures.
Will the charts render correctly in email clients?
Email clients can't run interactive charts, so charts from `[chart_library]` must be exported as static images for embedding. Confirm the generated code renders charts to images rather than relying on JavaScript, which most email clients strip out.
How does it avoid hitting sending rate limits?
It sends in batches of the size set in `[batch_size]`, defaulting to 50, rather than all at once. Keep the batch size within your provider's rate limits to avoid throttling, and the bounce-and-retry logic handles transient delivery failures.
Can I preview a report before it goes out?
Yes. The system includes a CLI with a report preview and manual trigger, so you can inspect the rendered HTML before any scheduled send. Always preview the first run, since email HTML frequently renders differently from how it looks in a browser.
How are sends tracked?
Every send is logged to the destination you set in `[log_destination]`, defaulting to a database table. Choose something queryable so you can verify whether a specific recipient received their report and debug delivery issues after the fact.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

Meer in Python & Automation Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support