Differentiate mail branding between subsites in multisite

Hi,

In a multisite setup we can differentiate multiple settings regarding the sending of emails via the October CMS backend, for example the mail configuration like sender name and sender email.

Could I kindly request that the mail branding could also be differentiated between sites? Different sites might have different styling, so it would seem logical that for example the colors would be different.

Does anyone know of a workaround on the short term?

Best regards,

M

Could you use the beforeSend event (beforeSend - October CMS) to modify the template layout based on the site?

Hi @apinard

Thanks for your insights.

That might be a good idea. I already base certain values of the mail templates of subsites on theme settings, via this snippet in the boot method of my custom plugin.

    App::before(function() {
        Event::listen('mailer.beforeAddContent', function ($mailer, $message, $view, $data)
        {
            if ($actheme = \Cms\Classes\Theme::getActiveTheme())
            {
                $themedata = [];
                $themailvars = explode(',', 'company,address,city,zipcode,vat,event,email,qr_disabled,fallback_logo,site_title');
                foreach ($themailvars as $themailvar)
                {
                    $themedata[$themailvar] = $actheme->{$themailvar};
                }
                View::share('theme', $themedata);
            }
        }, 5);
    });

In my theme settings (fields.yaml) in I also have different color values for each site:

    color:
        tab: Styling
        label: Primaire kleur
        type: colorpicker
        default: 'red'
    altcolor:
        tab: Styling
        label: Alternatieve kleur
        type: colorpicker
        default: 'red'
    red:
        tab: Styling
        label: Rood
        type: colorpicker
        default: 'red'
    altred:
        tab: Styling
        label: Rood (alternatief)
        type: colorpicker
        default: 'maroon'

It would be great if I could use the beforeSend event to overwrite the mail branding settings, and have them fall back to the colors I set in my theme. Could you help get me started?