Repository navigation
Attach the totals as a CSV file to the summary email - #1
Merged
VeljkoRailsware merged 1 commit intoOct 16, 2026
Merged
VeljkoRailsware merged 1 commit into
VeljkoRailsware merged 1 commit into
Conversation
The summary email now carries <upload>-summary.csv (column,total) through the Mailtrap Email API attachments array, so the report opens straight in a spreadsheet. Column names that a spreadsheet would run as formulas are prefixed with a quote to prevent CSV injection. No attachment is added when no column is fully numeric. The README gets a descriptive title, an intro that names the Mailtrap Email API and Email Sandbox, and an FAQ. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
The summary email now carries the totals as a CSV attachment, so the report opens straight in Excel, Numbers or Google Sheets instead of being copied out of the email body.
For
examples/sales.csvthe email getssales-summary.csv:It uses the
attachmentsarray of the Mailtrap Email API (base64content,text/csv,disposition: attachment).core.Mailerand theattachment()helper already supported this; the upload route just didn't use them. Sandbox, production andlogmode all work, and log-mode.emlpreviews include the file.Details
<upload name>-summary.csv, cleaned withwerkzeug.utils.secure_filename(../May sales.csvbecomesMay_sales-summary.csv; falls back tocsv-summary.csv).=,+,-or@get a leading', and spreadsheets open them as text instead of running them as formulas. Totals stay plain numbers.Docs
urllib, no SDK), with the Mailtrap Email Sandbox for testing; an updated "Try it" section; and an FAQ (sending an attachment from Flask, testing without real delivery, CSV injection, failed sends). This makes the README easier for people, search engines and LLM assistants to match to questions like "send CSV attachment from Flask".docs/email-setup.md: describes the attachment.Suggested repo "About" text (needs repo admin)
Suggested topics:
flask,python,csv,email,email-api,transactional-email,mailtrap.Testing
python -m pytest -q: 18 passed on Python 3.12 (2 new tests: attachment content, filename and formula escaping; no attachment without numeric columns).MAIL_MODE=log, uploadedexamples/sales.csvand checked the.emlpreview:sales-summary.csv,text/csv, correct totals.test_sandbox_and_live_http_payload_and_attachment.🤖 Generated with Claude Code