platformsh/laravel-bridge

MAIL_* variables not being honoured from $config resulting in wrong data in cache/config.php

Closed this issue · 2 comments

budda commented

I'm observing some odd behaviour with my Laravel project which doesn't appear to be picking up the Amazon SES SMTP config completely as defined in the Platform.SH env variables.

I've confirmed the variables are set correctly when doing a platform ssh and running printenv on the server terminal.

When I look in the bootstrap/cache/config.php only some of the MAIL_ related env values are set. Vitally the MAIL_HOST is blank!

Looking at this Laravel Bridge code I can see a method which setups Platform Mail...

function mapPlatformShMail(Config $config) : void
{
    if (!isset($config->smtpHost)) {
        return;
    }

    setEnvVar('MAIL_DRIVER', 'smtp');
    setEnvVar('MAIL_HOST', $config->smtpHost);
    setEnvVar('MAIL_PORT', '25');
    setEnvVar('MAIL_ENCRYPTION', '0');
}

From dumping the $config I can see ["smtpHost"]=> string(9) "SMTP_HOST" } which I guess means the if (!isset($config->smtpHost)) check above will not return and the MAIL_HOST gets set to "SMTP_HOST" and MAIL_PORT=25.

Should ["smtpHost"]=> string(9) "SMTP_HOST" } be getting set to "MAIL_HOST" instead?

Viewing the Laravel bootstrap/cache/config.php I can see the MAIL_PORT=25, but my variable sets it to MAIL_PORT=465 and that is also seen in the $config array in the Laravel Bridge code, but not in the final cached config.php.

Closing with #20

budda commented

@chadwcarlson are we getting a new tagged release of the package?