Repository navigation
feat(api-server): send content as written with subject, text_body and html_body - #42
Merged
maneesha-xyz merged 1 commit intoOct 30, 2026
Conversation
… html_body A caller that renders its own email had to pass it through a custom template, and templates are parsed with html/template: values from template_data are HTML-escaped in every block, and content written into the template runs as template code. /notify now also takes subject, text_body and html_body, sent as they are with no template applied. At least one body is required, and they can't be combined with template. The emailer renders a template into a Message and sends it the same way, as multipart/alternative with both bodies or a single part with one. The README documents the fields and corrects the template syntax it named (html/template, not text/template).
Closed
11 of 17 tasks
mushrafmim
added a commit
to mushrafmim/nsw-srilanka
that referenced
this pull request
Oct 29, 2026
…n v0.3.0 Bump core/notification to v0.3.0 and add notification.providers.smtp, its SMTP provider, beside the PingMailer email provider. Both send email, so a config sets one of them; setting both is refused. PingMailer takes only a template and template data until OpenGovMail/pingmailer#42 is deployed, so it can't send our rendered email yet. The example configs and the Helm values send email through smtp, with NOTIFICATION_SMTP_PASSWORD as its secret. Refs OpenNSW#917 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 of 17 tasks
Aravinda-HWK
marked this pull request as ready for review
October 29, 2026 15:57
mushrafmim
added a commit
to mushrafmim/nsw-srilanka
that referenced
this pull request
Oct 30, 2026
…n v0.3.0 Bump core/notification to v0.3.0 and add notification.providers.smtp, its SMTP provider, beside the PingMailer email provider. Both send email, so a config sets one of them; setting both is refused. PingMailer takes only a template and template data until OpenGovMail/pingmailer#42 is deployed, so it can't send our rendered email yet. The example configs and the Helm values send email through smtp, with NOTIFICATION_SMTP_PASSWORD as its secret. Refs OpenNSW#917 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mushrafmim
added a commit
to mushrafmim/nsw-srilanka
that referenced
this pull request
Oct 31, 2026
…n v0.3.0 Bump core/notification to v0.3.0 and add notification.providers.smtp, its SMTP provider, beside the PingMailer email provider. Both send email, so a config sets one of them; setting both is refused. PingMailer takes only a template and template data until OpenGovMail/pingmailer#42 is deployed, so it can't send our rendered email yet. The example configs and the Helm values send email through smtp, with NOTIFICATION_SMTP_PASSWORD as its secret. Refs OpenNSW#917 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sthanikan2000
pushed a commit
to mushrafmim/nsw-srilanka
that referenced
this pull request
Nov 1, 2026
…n v0.3.0 Bump core/notification to v0.3.0 and add notification.providers.smtp, its SMTP provider, beside the PingMailer email provider. Both send email, so a config sets one of them; setting both is refused. PingMailer takes only a template and template data until OpenGovMail/pingmailer#42 is deployed, so it can't send our rendered email yet. The example configs and the Helm values send email through smtp, with NOTIFICATION_SMTP_PASSWORD as its secret. Refs OpenNSW#917 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Aravinda-HWK
pushed a commit
to mushrafmim/nsw-srilanka
that referenced
this pull request
Nov 2, 2026
…n v0.3.0 Bump core/notification to v0.3.0 and add notification.providers.smtp, its SMTP provider, beside the PingMailer email provider. Both send email, so a config sets one of them; setting both is refused. PingMailer takes only a template and template data until OpenGovMail/pingmailer#42 is deployed, so it can't send our rendered email yet. The example configs and the Helm values send email through smtp, with NOTIFICATION_SMTP_PASSWORD as its secret. Refs OpenNSW#917 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
zaeema-n
pushed a commit
to zaeema-n/nsw-srilanka
that referenced
this pull request
Nov 3, 2026
…notification v0.3.0 (OpenNSW#962) * feat(notification)!: send email through PingMailer with core/notification v0.2.0 Replace github.com/OpenNSW/core/notifications with github.com/OpenNSW/core/notification v0.2.0. Its email provider posts to PingMailer's POST /notify with a token from an oauth2 client, so the email block takes auth, smtpHost, smtpPort and sender in place of token. BREAKING CHANGE: notification.providers.email.token is gone; set auth, smtpHost, smtpPort and sender instead. NOTIFICATION_EMAIL_TOKEN is renamed NOTIFICATION_EMAIL_CLIENT_SECRET (Helm secret key notification-email-client-secret). Closes OpenNSW#917 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(notification): make notification providers optional Each provider under notification.providers is now optional. With none set the server starts, and the notification extension logs each notification as skipped. The dev and agency configs leave the section commented out, so running the stack locally needs no gateway credentials. Refs OpenNSW#917 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(notification): send email straight to SMTP with core/notification v0.3.0 Bump core/notification to v0.3.0 and add notification.providers.smtp, its SMTP provider, beside the PingMailer email provider. Both send email, so a config sets one of them; setting both is refused. PingMailer takes only a template and template data until OpenGovMail/pingmailer#42 is deployed, so it can't send our rendered email yet. The example configs and the Helm values send email through smtp, with NOTIFICATION_SMTP_PASSWORD as its secret. Refs OpenNSW#917 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(compose): pass NOTIFICATION_SMTP_PASSWORD to the server The SMTP provider reads {{env:NOTIFICATION_SMTP_PASSWORD}}; pass it through so enabling SMTP needs only the config and .env, not a compose edit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(notification): show PingMailer's email provider beside SMTP in the configs Where the cluster can't reach the SMTP server's submission port, as in LGC, email goes through PingMailer's API with a client credentials token. The example and agency configs now list the email, smtp and sms providers, commented out; the Helm example sends through email and keeps smtp commented, and passes NOTIFICATION_EMAIL_CLIENT_SECRET from nsw-secrets. Compose passes it through too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
Description
/notifynow takessubject,text_bodyandhtml_body, and sends them exactly as written, with no template applied. This is for a caller that renders its own email.A custom template can't carry such content. Templates are parsed with
html/template, nottext/templateas the README said:template_dataare HTML-escaped in every block, the subject and plain body included. An HTML body arrives as escaped text, and&in a subject arrives as&.{{it contains as template code.Type of Change
Changes Made
internal/api/handlers.go:subject,text_bodyandhtml_bodyon the request. With any of them set, at least one body is required, andtemplatecan't be set too (400). Each recipient gets the content as written.internal/emailer/emailer.go:SendMessagesends aMessage(subject and bodies) as written. Template sends now render into aMessageand go out the same way. Both bodies givemultipart/alternative; one body gives a single part.README.md: documents the fields, and corrects the template syntax tohtml/template, noting thattemplate_datavalues are escaped.Testing
go vet ./...andgo test ./...inapi-server. Template sends are unchanged: the rendering code moved, not its logic. Not yet run against a live SMTP server.Checklist
Related Issues
Needed by OpenNSW/nsw-srilanka#919, which sends TNSW's notification email through PingMailer (OpenNSW/nsw-srilanka#917).