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

Method SetEmailSender

internal/server/server.go:710–722  ·  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

708// fail to take effect when callers wired email and cloud mode in
709// either order.
710func (s *Server) SetEmailSender(e *email.Sender, apiKey ...string) {
711 s.email = e
712 // A sender wired here comes from an out-of-band source (env vars at startup).
713 // Mark it so reconfigureEmail leaves it in place when platform settings carry
714 // no key — env is the deployment baseline, not something the admin UI disables.
715 s.emailEnvConfigured = e != nil
716 if len(apiKey) > 0 {
717 s.emailAPIKey = apiKey[0]
718 }
719 if s.cloudMode && s.email != nil {
720 s.email.SetCloudMode(true)
721 }
722}
723
724// SetCORSOrigins configures allowed CORS origins (comma-separated).
725func (s *Server) SetCORSOrigins(origins string) {

Calls 1

SetCloudModeMethod · 0.45