Document SMTP email setup for Docker Compose #4372
All Vouch review confidence checks passed
Residual risk 0.30 = Change Risk (0.52) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #4372"
general
weight: 0.35
jaysbeekay
Closes #4364
Fork pre-flight: jaysbeekay/sure#521, from the same branch and commit. Its CI runs and reviews, and the fork issue with the plan (jaysbeekay/sure#502), are there.
Problem
docs/hosting/docker.mdhas no section on sending email. A self-hoster has to work out the setup from the code, and it fails silently in three ways:compose.example.ymlpasses only the keys listed in itsx-rails-envanchor, and has noenv_file, so values set only in.envare dropped.deliver_later_queue_name = :high_priority,config/environments/production.rb:77), notweb.sender@sure.local(app/mailers/application_mailer.rb:3) and the relay rejects it.Change
Docs only. A new "Sending email (SMTP)" section in
docs/hosting/docker.md, after "Using HTTPS":"true"comparison forSMTP_TLS_ENABLEDandSMTP_TLS_SKIP_VERIFY, thesender@sure.localfallback, and that the worker sends mail.x-rails-envanchor, which bothwebandworkermerge. Includes a snippet and the matching.envlines. A sentence under the snippet says its Compose defaults (port 465, TLS from the start) differ from the app's own in the table, and the.envexample carries commentedSMTP_PORT="587"/SMTP_TLS_ENABLED="false"lines for STARTTLS..envreaches the app as an empty string, not as unset. An emptyEMAIL_SENDERreplaces the fallback, and an emptySMTP_USERNAMEstill makes the app attempt SMTP AUTH. The section tells readers to set every listed key and leave out the login keys for a relay that needs no login.docker compose up -d;docker compose restartkeeps the old environment.Verification
Variable names, each checked against the code at
7917bc1e4:| Variable | Read at |
|---|---|
|
APP_DOMAIN|config/environments/production.rb:78||
SMTP_ADDRESS|config/environments/production.rb:81||
SMTP_PORT|config/environments/production.rb:82||
SMTP_USERNAME|config/environments/production.rb:83||
SMTP_PASSWORD|config/environments/production.rb:84||
SMTP_TLS_ENABLED|config/environments/production.rb:85(== "true") ||
SMTP_TLS_SKIP_VERIFY|config/environments/production.rb:86(== "true") ||
SSL_CA_FILE|config/environments/production.rb:87||
EMAIL_SENDER|app/mailers/application_mailer.rb:3(ENV.fetch, fallbacksender@sure.local) |Emails, each checked against the code at
7917bc1e4:| Email | Sent at | Condition on a self-hosted instance |
|---|---|---|
| Password reset |
app/controllers/password_resets_controller.rb:20|ensure_password_resets_enabled(:49,AuthConfig.password_features_enabled?) || Email-change confirmation |
app/models/user.rb:138| skipped whenself_hosted? && !Setting.require_email_confirmation(user.rb:134), the "Require email confirmation" toggle under Self-Hosting || Rule notification |
app/jobs/rule_email_notification_job.rb:15| a rule with the "Send email notification" action || PDF import follow-up |
app/models/pdf_import.rb:391, fromapp/jobs/process_pdf_job.rb:36| none || Invitation |
app/controllers/invitations_controller.rb:27| never:deliver_later unless self_hosted?|The settings hash keys are
address,port,user_nameandtls(production.rb:81-85), so the check command'sslice(:address, :port, :user_name, :tls)matches them and leaves outpassword.Defaults and TLS modes were checked against the locked gems (mail 2.9.1, net-smtp 0.5.1), building the session from the same settings hash:
SMTP_PORTunset: port 25.SMTP_TLS_ENABLED=true: implicit TLS, no STARTTLS.SMTP_TLS_ENABLEDunset,Trueor1: plain connection with STARTTLS auto.ENV.fetch("EMAIL_SENDER", "sender@sure.local")returns""when the variable is set but empty."".Compose snippet: merged into the
x-rails-envanchor of a copy ofcompose.example.ymland run throughdocker compose config(Compose v5.6.0). Exit code 0. With the.envfrom the section,webandworkerboth resolve all seven keys. With no.env, both get""for each key that has no:-default, andSMTP_PORT: "465"andSMTP_TLS_ENABLED: "true"from the defaults.The section uses only example.com hosts and addresses, apart from the code's own
sender@sure.local.bin/rails test: 12474 runs, 0 failures, 0 errors, 36 skips. Markdown only, so rubocop, erb_lint, Biome and brakeman have nothing to check.<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
Documentation
Added guidance for configuring SMTP email delivery in self-hosted deployments, including which email types are sent and that invitations are not emailed.
Documented SMTP settings, defaults, TLS options, and how empty values differ from unset values.
Included Docker Compose examples, instructions for mounting a custom CA certificate and recreating containers, and a way to review worker settings without displaying the password.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->