MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / SetEmailSender

Method SetEmailSender

internal/server/server.go:728–740  ·  view source on GitHub ↗

SetEmailSender attaches a transactional email sender. The apiKey is stored separately for deriving the unsubscribe HMAC secret. If the server is already in cloud mode when this is called (i.e. SetCloudMode ran before email config arrived from main.go), propagate the flag so the new sender adds the

(e *email.Sender, apiKey ...string)

Source from the content-addressed store, hash-verified

726// fail to take effect when callers wired email and cloud mode in
727// either order.
728func (s *Server) SetEmailSender(e *email.Sender, apiKey ...string) {
729 s.email = e
730 // A sender wired here comes from an out-of-band source (env vars at startup).
731 // Mark it so reconfigureEmail leaves it in place when platform settings carry
732 // no key — env is the deployment baseline, not something the admin UI disables.
733 s.emailEnvConfigured = e != nil
734 if len(apiKey) > 0 {
735 s.emailAPIKey = apiKey[0]
736 }
737 if s.cloudMode && s.email != nil {
738 s.email.SetCloudMode(true)
739 }
740}
741
742// SetCORSOrigins configures allowed CORS origins (comma-separated).
743func (s *Server) SetCORSOrigins(origins string) {

Calls 1

SetCloudModeMethod · 0.45