Problem/Motivation

We typically use environment variables in our local, development, staging and production environments to store credentials for various drupal modules and services, and configure overrides in settings.php to utilize the values stored in environment variables as config override values for different environments.

Every time we configure an environment variable to store anything other than the 'smtp_host', sending mail from the site fails.

Hard-coding those configuration override values in settings.php, however, works.

To make this work unilaterally, requires that we add extensive logic for each hard-coded value that changes per environment, making a standard configuration workflow much more friable.

Steps to reproduce

Configure a config override in settings.php for the 'smtp_port' with a hard-coded value, and reset the cache.
Test sending an email and verify that this is successful.

Set an environment variable called "SMTP_PORT" to the same value as the override value above.
Change the config override in settings.php to read the environment variable instead, using getenv('SMTP_PORT'), and reset the cache.
Test sending an email -- this will fail.

Scratching my head on this one.

Comments

lhridley created an issue. See original summary.

bluegeek9’s picture

Category: Bug report » Support request

I think getenv('SMTP_PORT') is returning FALSE. How is the SMTP_PORT variable set?

This line will work when SMTP_PART is not set.

getenv('SMTP_PORT') ?? 25;
bluegeek9’s picture

Status: Active » Postponed (maintainer needs more info)
Issue tags: -Configuration overrides
bluegeek9’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)

I am closing the issue due to the age. I you need assistance on this issue, please change the status to Active.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

bluegeek9’s picture

Status: Closed (outdated) » Fixed
//www.flaticon.com/free-icons/thank-you Thank you for your contribution! Your continued support makes this project sustainable.
There are multiple ways to show appreciation for the work contributed to this project including:
  • Triage issues and adding more context to existing issues.
  • Flagging SMTP as a favorite on the project page to help others discover it and show your support.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.