Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multisite setup #31

Open
green17 opened this issue Nov 7, 2023 · 0 comments
Open

Multisite setup #31

green17 opened this issue Nov 7, 2023 · 0 comments
Labels

Comments

@green17
Copy link

green17 commented Nov 7, 2023

We currently have Postmark setup with Craft using environment variables. As we have a two site setup we would like to change the setup so that each site has it's own stream. We have tried a number of things in config/app.php (please see example below) but it doesn't seem to get picked up.

'mailer' => function() {
    // Get the stored email settings
    $settings = craft\helpers\App::mailSettings();

    // Override the transport adapter class
    $settings->transportType = craft\postmark\Adapter::class;

    if (Craft::$app->sites->getCurrentSite()->handle === 'siteTwo') {
        // Override the transport adapter settings
        $settings->transportSettings = [
            'token' => getenv('POSTMARK_SERVER_API_TOKEN'),
            'messageStream' => getenv('POSTMARK_MESSAGE_STREAM_ID_TRANSACTIONAL_SITETWO'),
        ];
        $settings->fromEmail = getenv('EMAIL_SYSTEM_EMAIL_ADDRESS');
        $settings->fromName = getenv('EMAIL_SENDER_NAME'); 
    }

    // Create a Mailer component config with these settings
    $config = craft\helpers\App::mailerConfig($settings);

    // Instantiate and return it
    return Craft::createObject($config);
},

Craft Pro 3.8.13
Postmark 2.1.0

@green17 green17 added the bug label Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant