ability to email a group - #1
Draft
chishiki wants to merge 1 commit into
Draft
Conversation
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
Adds a reusable way to send one email to every member of a UW NetID group, the foundational building block for any future feature that needs to notify a group (e.g. a stale-content digest). This PR is just the mailer itself, not any specific notification.
NetIDGroups::getGroupMemberEmails()maps a group's member NetIDs tonetid@uw.edu, UW's standard forwarding address, rather than sending to the group's own email alias (which may not exist, may not match the Group ID, and requires separate "authorized senders" configuration in groups.uw.edu we can't verify from Drupal).GroupMailer::sendToGroup($group, $subject, $body)refuses to send to any group not inuw_groups.settings:active_groups, logging the refusal instead of failing silently. That allow-list is the only set of groups the LTS service account is known to have membership-viewer access to; other UW Groups, especially Restricted/Confidential institutional ones, may reject or silently empty-out membership queries from these credentials.{sent, failed, error}instead of throwing, so a future caller (e.g. cron code) can decide how to react to a membership-fetch failure or a partial send failure, rather than the mailer making that call unilaterally.hook_mail()'sgroup-noticekey takessubject/bodyfrom params rather than hardcoding copy, mirroring the pattern inmoderation_emails.modulebut generalized so it isn't coupled to one notification's wording.Testing
drush php:eval "print_r(\Drupal::service('uw_groups.group_mailer')->sendToGroup('<a real active group>', 'Test subject', 'Test body'));"against an environment with the LTS mTLS credentials configurederror: group_not_activeand sends nothing