I have env variables setup for a SMTP connection. These setting work correctly locally, the same on a production server don't work.

After some troubleshooting, if I manually add the password via the Settings > Mail UI it works but the instant I go with the env variable $SMTP_PASS which has the same string, it won't send email.

Taking a look at the logs, it appears it is taking the literal string of the env variable.

    'craft\\mail\\transportadapters\\Smtp' => [
        'host' => '$SMTP_HOST_NAME'
        'port' => '$SMTP_PORT'
        'useAuthentication' => '1'
        'username' => '$SMTP_USER'
        'password' => '••••••••••'
        'encryptionMethod' => 'ssl'
        'timeout' => '10'

Anyone have any ideas why this would behave this way?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.