SMTP not working when using ENV variables
I'm self-hosting Docuseal using Docker Compose and following the official instructions for configuring environment variables. Here's how I'm setting up the SMTP configuration (variables are populated correctly, verified at the OS level):
- SMTP_USERNAME=${SMTP_USER}
- SMTP_ADDRESS=${SMTP_HOST}
- SMTP_PORT=${SMTP_PORT}
- SMTP_PASSWORD=${SMTP_PASSWORD}
- SMTP_AUTHENTICATION=login
- SMTP_FROM=${SMTP_FROM}
- SMTP_ENABLE_STARTTLS_AUTO
Despite this setup, I’m unable to send emails. I've tried different combinations, like switching SMTP_AUTHENTICATION between login and plain, and enabling/disabling STARTTLS. However, when I omit the SMTP_ADDRESS variable to enable the email configuration via the UI and manually input the same SMTP details, it works fine.
I'm puzzled about what might be missing or misconfigured in the environment variables. Any ideas?
@TotalLag can you please check /jobs page to see if it contains failed email sending jobs with error messages?
@omohokcoj no changes I can observe in /jobs. It continues to show 3 processed and 0 across the board.
If I visit the /settings/email page and try to manually send using the ENV variables, I get Net::ReadTimeout with #<TCPSocket:(closed)> -- thinking this could be some escaping issue, when I set SMTP_ADDRESS="with.quotes.net" like this then I proceed to get getaddrinfo: Unrecognized service
This is what my environment looks like (I removed some variables for troubleshooting):
DATABASE_URL=postgresql://<redacted>@postgresql:5432/docuseal
SMTP_ADDRESS=smtp.<redacted>.net
HOSTNAME=<redacted>
SMTP_PORT=465
SHLVL=2
HOME=/root
COOLIFY_FQDN=<redacted>
BUNDLE_APP_CONFIG=/usr/local/bundle
BUNDLE_WITHOUT=development:test
SMTP_USERNAME=<redacted>@<redacted>.<redacted>
RUBY_DOWNLOAD_URL=https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.4.tar.xz
RUBY_VERSION=3.3.4
OPENSSL_CONF=/app/openssl_legacy.cnf
TERM=xterm
PATH=/usr/local/bundle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
LANG=C.UTF-8
LD_PRELOAD=/lib/libgcompat.so.0
SMTP_FROM=<redacted>@<redacted>.<redacted>
HOST=https://<redacted>/
WORKDIR=/data/docuseal
COOLIFY_CONTAINER_NAME="<redacted>"
GEM_HOME=/usr/local/bundle
RAILS_ENV=production
COOLIFY_URL=<redacted>
RUBY_DOWNLOAD_SHA256=1caaee9a5a6befef54bab67da68ace8d985e4fb59cd17ce23c28d9ab04f4ddad
PWD=/data/docuseal
SMTP_PASSWORD=<redacted>
BUNDLE_SILENCE_ROOT_WARNING=1
The only thing I can see that's missing from the ENV that exist in the UI is an SMTP_SECURITY equivalent