Repository navigation
Hide BCC from recipients and deliver to every CC/BCC address - #126
Merged
Merged
Conversation
Three problems with CC and BCC on assignment emails:
- The Bcc header was sent along with the message (sendmail with the
whole message as a string), so every recipient could see who was
BCC'd. Drop it from what is transmitted.
- Several addresses in CC or BCC were given to the SMTP server as one
recipient ("a@x.edu, b@x.edu"), which it refuses; since the student was
still accepted, nothing failed and the CC'd addresses silently got
nothing. Give each address separately, and trim them in the headers.
- In a send to many students, every student's email was CC'd and BCC'd,
so a CC'd address got one copy per student and every student saw it.
Copy CC and BCC on the first student's email only, and say so on the
email page.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Coverage for e2e tests for Python 3.14
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #126 +/- ##
==========================================
+ Coverage 66.34% 66.45% +0.11%
==========================================
Files 29 29
Lines 2383 2391 +8
==========================================
+ Hits 1581 1589 +8
Misses 802 802 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
🚀 Staging Preview Deployed! URL: https://preview-seating-pr-126-137456085712.us-west1.run.app |
CC is how course staff see a student's reply-all, so every student's email has to carry it; copying CC and BCC on the first email only broke that. Put them back on every email (as before this PR), and test that they are there. Hiding the Bcc header and delivering to each address separately stay. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Coverage for unit tests for Python 3.14
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Coverage for e2e tests for Python 3.14
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Coverage for unit tests for Python 3.14
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Coverage for e2e tests for Python 3.14
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Coverage for unit tests for Python 3.14
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Coverage for e2e tests for Python 3.14
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
Summary
Two bugs with CC and BCC on assignment emails, found while looking into #86.
send_email_batchsentmsg.as_string()withsendmail, which includes theBcc:header, so each student could see who was BCC'd.get_all('Cc')returns it as one string,'ta1@…, ta2@…'. That string was given to the SMTP server as one recipient, which it refuses. The student was still accepted, so nothing reported a failure.Reproduced on
mainagainst a local SMTP server, with a message with two CCs and a BCC:Bcc: hidden@berkeley.edu.student@…, hidden@…, so neither CC'd address got the email.Every student's email is still CC'd and BCC'd, as before: CC is how course staff see a student's reply-all.
Changes
server/services/email/smtp.py:message_recipients(msg)lists every address from the To, Cc and Bcc headers, each one separately, usingemail.utils.getaddresses.send_email_batchpasses those recipients tosendmail(the envelope, which decides delivery) and sends a copy of the message with theBccheader removed (what recipients see). BCC'd addresses still get the email. The message object itself isn't changed.construct_emailtrims the addresses in CC and BCC, so the header readsta1@…, ta2@…instead ofta1@…, ta2@….Tests
tests/unit/test_email_copies.py:message_recipientsgives each address separately, for one or several addresses in CC and BCC.Locally: unit 266, e2e 13, a11y 4 passing.
🤖 Generated with Claude Code