Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsubscribe links and domain-only "From" email addresses #3721

Merged
merged 18 commits into from
Mar 6, 2024
Merged

Conversation

willgearty
Copy link
Member

@willgearty willgearty commented Feb 16, 2024

This does the following:

  • Can now generate unsubscribe links for users (including adding these to commpanel emails)
  • Upon clicking these links, users can unsubscribe without logging in (within 7 days of being generated)
  • Email clients can also use a "oneclick" version to instantly unsubscribe a user with a single POST
  • The "From" email address for comm panel emails must now contain the LU domain or any LU subdomain (or a chapter-specific alias); there is a nice big red banner to announce this and there are frontend and backend checks to enforce this
  • To help chapters, we now use the [email protected] email redirect (which is by default set to their "default" email address); this is now automatically populated in the "From" field
  • The "director_email" field for a program now must match our new "From" constraints. This is enforced at the database level and also in the new program and program settings forms.
  • I've set up a migration that will replace any existing "director_email" fields that don't match with [email protected]. This migration also sets up the [email protected] email redirect.
  • send_mail() also requires that the "from_email" matches these constraints and throws an error if this is not the case (just in case it somehow got through the above restrictions).
  • We now include a plaintext version of HTML emails to support all email clients (even plaintext-only ones)
  • Various minor fixes to emails that were being sent from domains/subdomains not associated with our DMARC records (like spoofing users when we sent the director an interview notification).

Fixes #1719 and fixes #3709 and fixes #1094.

@willgearty
Copy link
Member Author

This is finally ready to be reviewed @kkbrum @milescalabresi!

Copy link
Contributor

@kkbrum kkbrum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The migrations and such look good. The template tag unsubscribe link works well at least when the token is valid. For the other forms, I'll have to test a bit more on dev5 when we test the stable release. For now, just one minor request clarifying the username.

esp/templates/users/unsubscribe.html Outdated Show resolved Hide resolved
@willgearty willgearty requested a review from kkbrum March 1, 2024 01:16
@willgearty
Copy link
Member Author

Done!

@willgearty willgearty merged commit dadf4ac into main Mar 6, 2024
5 checks passed
@willgearty willgearty deleted the unsub-link branch March 6, 2024 01:13
willgearty added a commit that referenced this pull request Mar 9, 2024
* Generate unsubscribe links and add unsubscribe headers to emails

* Add separate view for oneclick POSTs; add unsubscribe confirmation button

* Constrain "from" email address for comm panel

* lint fixes

* Fix regex

* Make director email match domain/subdomain pattern

* Add migration; fix regex

* Fix tests

* fix more tests

* require that the from_email for send_mail matches our DMARC; always include a plaintext version of emails

* lint fix

* Add info@ PlainRedirect if it doesn't exist with migration

* Misc fixes

* lint fix

* Include email in error message to help with debugging

* Support named email addresses

* Fix commpanel test

* Add username
willgearty added a commit that referenced this pull request Mar 9, 2024
* Generate unsubscribe links and add unsubscribe headers to emails

* Add separate view for oneclick POSTs; add unsubscribe confirmation button

* Constrain "from" email address for comm panel

* lint fixes

* Fix regex

* Make director email match domain/subdomain pattern

* Add migration; fix regex

* Fix tests

* fix more tests

* require that the from_email for send_mail matches our DMARC; always include a plaintext version of emails

* lint fix

* Add info@ PlainRedirect if it doesn't exist with migration

* Misc fixes

* lint fix

* Include email in error message to help with debugging

* Support named email addresses

* Fix commpanel test

* Add username
willgearty added a commit that referenced this pull request Mar 9, 2024
* Generate unsubscribe links and add unsubscribe headers to emails

* Add separate view for oneclick POSTs; add unsubscribe confirmation button

* Constrain "from" email address for comm panel

* lint fixes

* Fix regex

* Make director email match domain/subdomain pattern

* Add migration; fix regex

* Fix tests

* fix more tests

* require that the from_email for send_mail matches our DMARC; always include a plaintext version of emails

* lint fix

* Add info@ PlainRedirect if it doesn't exist with migration

* Misc fixes

* lint fix

* Include email in error message to help with debugging

* Support named email addresses

* Fix commpanel test

* Add username
willgearty added a commit that referenced this pull request Mar 9, 2024
* Generate unsubscribe links and add unsubscribe headers to emails

* Add separate view for oneclick POSTs; add unsubscribe confirmation button

* Constrain "from" email address for comm panel

* lint fixes

* Fix regex

* Make director email match domain/subdomain pattern

* Add migration; fix regex

* Fix tests

* fix more tests

* require that the from_email for send_mail matches our DMARC; always include a plaintext version of emails

* lint fix

* Add info@ PlainRedirect if it doesn't exist with migration

* Misc fixes

* lint fix

* Include email in error message to help with debugging

* Support named email addresses

* Fix commpanel test

* Add username
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants