Skip to content

Unable to send a test email once every student has been emailed #147

Closed

Description

@pancakereport

The email page starts with the To field holding only students who haven't been emailed yet. Once everyone has been emailed, To is empty. Because To is required, the browser blocks every button that submits the form, including Send test. Nothing tells staff why the click did nothing.

The server also refuses it. EmailForm.to_addr is InputRequired(), and the test-email path only runs after the whole form validates. So a test sent without JavaScript fails with "to_addr: This field is required."

To reproduce

  1. Seat at least one student and email all students from the email page.
  2. Go back to the email page (/students/email/). To is empty, with "Leaving out N students already emailed."
  3. Pick a student under "Send a test", enter your address and click Send test.

Expected: the test email is sent to that address. It doesn't need anyone in To, since a test only goes to the test address.

Actual: nothing happens. The browser highlights the empty To field, and no message says why.

Workaround: click "Email them again too" to refill To, then send the test. You then have to be careful not to click "Send to students" afterwards.

Possible fix

  • Make To required only for the real send:
    • Server: check To in the send paths rather than in the form's validators. Those paths are email_all_students, email_students_batch and email_single_student.
    • Browser: take off To's required attribute and check it in the "Send to students" handler instead.
  • Give Send test (and Preview, from Have staff write assignment emails as plain text #145) formnovalidate so the browser doesn't block them on fields they don't use.
  • Add a test: with every student already emailed, a test email still sends.

Activity

  1. YashChainani28 commented on Oct 28, 2026

    @YashChainani28

    working on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions