fix: disable email delivery when SMTP is not configured#831
Open
rewritten wants to merge 2 commits intocoopdevs:developfrom
Open
fix: disable email delivery when SMTP is not configured#831rewritten wants to merge 2 commits intocoopdevs:developfrom
rewritten wants to merge 2 commits intocoopdevs:developfrom
Conversation
…vs#822, refs coopdevs#827) When no SMTP_* environment variables are set, fall back to :test delivery method instead of attempting SMTP, and print a warning at startup. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adjusts production environment mailer configuration so the app can boot and operate without SMTP settings, aligning with #822 by preventing SMTP-related failures when SMTP_* env vars are absent.
Changes:
- Builds
smtp_envfromSMTP_*environment variables usingENV.filter(...).to_h(...). - Sets Action Mailer delivery method to
:smtponly when SMTP settings are present. - Falls back to a non-SMTP delivery method and emits a startup warning when SMTP is not configured.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+90
to
+91
| smtp_env = ENV.filter { |k, _| k.start_with?("SMTP_") } | ||
| .to_h { |k, v| [k.delete_prefix("SMTP_").downcase.to_sym, YAML.load(v)] } |
There was a problem hiding this comment.
YAML.load(v) will deserialize arbitrary YAML from environment variables, which can instantiate unexpected Ruby objects and is generally unsafe. Prefer YAML.safe_load (permitting only basic scalar types you expect) or explicit casting (e.g., int/bool parsing) for SMTP settings values.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.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.
Summary
SMTP_*environment variables are set, fall back to:testdelivery method instead of attempting SMTP (which would crash with a 500 error)[TimeOverflow] No SMTP configuration found (SMTP_* env vars). Email delivery is disabled.Fixes #822, refs #827.
Test plan
SMTP_*env vars — confirm no email-related errors and the warning appears in logsSMTP_*env vars set — confirm emails are delivered normally via SMTP🤖 Generated with Claude Code