Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change email css theme at runtime - Laravel

According to documentation, to change email css, simply write a new CSS file within the html/themes directory and change the theme option of your mail configuration file.

In my application has two locales. each locale has different css style. my question is: how to change the css theme at runtime according to app locale?

like image 264
Usama Avatar asked Dec 11 '25 16:12

Usama


1 Answers

This works with Laravel 5.7

Assuming you have in /resources/views/vendor/mail/html/themes/ multiple css files:

themes
 >default.css
 >funky_table.css 

you can set the theme in you build method.

public function build()
    {
        $this->theme = 'funky_table';
        return $this->markdown(...

This will also work for queries.

like image 84
Adam Avatar answered Dec 13 '25 06:12

Adam



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!