3

I have this custom config in config/app.php, but Craft seems to keep using the default Control panel Sendmail config.

It seems this doesn't get merged in the main.php file. (as promised)

 return [
 'components' => [
     'mailer' => function() {

        // Get the stored email settings
        $settings = Craft::$app->systemSettings->getEmailSettings();

        // Override the transport adapter class
        $settings->transportType = craft\mail\transportadapters\Smtp::class;

        // Override the transport adapter settings
        $settings->transportSettings = [
            'host' => 'xx',
            'port' => 'xx',
            'useAuthentication' => true,
            'username' => 'xx',
            'password' => 'xx'
        ];

        return craft\helpers\MailerHelper::createMailer($settings);
     },
 ],

];

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.