BoilerPrompt
Cursor

Cursor prompt to add email notifications

Email notifications that stay out of the request path: one mailer module, a file per template, and a dev mode that writes rendered HTML to disk instead of sending. Cursor applies this as diffs across your handlers, so you can see exactly where sends were added and confirm none of them can fail a request.

Last updated

Prompt
Add transactional email notifications to this app for three events: signup welcome, password reset, and a weekly summary of {{resource}} activity. Build a thin mailer module with one send function so the provider SDK is imported in exactly one file and stays swappable. Templates are code, not strings inside handlers: one file per email under emails/, each exporting a subject and HTML plus a plain text fallback. In development, send nothing, write each rendered email to .dev-mail/ as an HTML file I can open. Sending must be fire-and-forget from request handlers, a failed send may never fail the user's request, log it instead. The weekly summary runs from its own cron entry point script, not inside the web process. Add tests asserting each template renders with sample data. Run the tests, then list new files and every handler you modified.

Customize it

Runs in your browser. Nothing you type here is sent anywhere.

Your customized prompt
Add transactional email notifications to this app for three events: signup welcome, password reset, and a weekly summary of users activity. Build a thin mailer module with one send function so the provider SDK is imported in exactly one file and stays swappable. Templates are code, not strings inside handlers: one file per email under emails/, each exporting a subject and HTML plus a plain text fallback. In development, send nothing, write each rendered email to .dev-mail/ as an HTML file I can open. Sending must be fire-and-forget from request handlers, a failed send may never fail the user's request, log it instead. The weekly summary runs from its own cron entry point script, not inside the web process. Add tests asserting each template renders with sample data. Run the tests, then list new files and every handler you modified.

Same task in other tools

Questions about this prompt

No email provider is named. What does the agent use?

Whatever SDK it finds in your lockfile, so name one in the first line if the project has none yet. Because every import goes through the single mailer module, swapping providers later touches exactly one file.

How do I look at the emails while developing?

Open the rendered HTML files in .dev-mail/ directly in a browser. If you want more, ask a follow-up for a small index page that lists them by date, and the agent will add it without touching the send logic.

Where should the weekly summary actually run in production?

The prompt forces it into a standalone entry point script precisely so it is not tied to the web process. Point your platform's scheduled job at that script, and verify it once by running the script manually in the terminal.

Related prompts