Add 'Email All' feature for users#306
Draft
cmyers-mieweb wants to merge 1 commit into
Draft
Conversation
Add UI, route, and email utility to send a message to all users with an email address. Changes include: - routers/users.js: import sendBulkEmail and add POST /users/email-all which validates subject/message, checks SMTP configuration, collects unique non-empty user emails, calls sendBulkEmail, and sets flash messages for success/partial/failure cases with error logging. - utils/email.js: add sendBulkEmail (sends one message per recipient using configured noreply address), escapeHtml helper to sanitize HTML body, and export sendBulkEmail. - views/users/index.ejs: add "Email All" button and modal form to compose subject and message, showing recipient count and confirming send. Includes basic input validation, SMTP existence check, per-recipient send reporting, and HTML-escaping of message content.
runleveldev
requested changes
May 13, 2026
Comment on lines
+178
to
+179
| const settings = await Setting.getMultiple(['smtp_noreply_address']); | ||
| const from = settings.smtp_noreply_address || 'noreply@localhost'; |
Collaborator
There was a problem hiding this comment.
I don't like this fallback. If smtp_noreply_address is not set this should throw up instead.
Comment on lines
+198
to
+211
| for (const to of recipients) { | ||
| try { | ||
| await transporter.sendMail({ | ||
| from, | ||
| to, | ||
| subject, | ||
| text: message, | ||
| html | ||
| }); | ||
| sent.push(to); | ||
| } catch (error) { | ||
| failed.push({ to, error: error.message }); | ||
| } | ||
| } |
Collaborator
There was a problem hiding this comment.
Can we do a single email with BCC instead of looping?
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.
issue: #305
Add UI, route, and email utility to send a message to all users with an email address. Changes include:
Includes basic input validation, SMTP existence check, per-recipient send reporting, and HTML-escaping of message content.
