Home > Back-end >  Can not style Laravel mail with queues
Can not style Laravel mail with queues

Time:08-02

when I send mail with queue and want to customize css for markdown mails it does not work, everything works correct without queues, is that known issue?

when I have

Mail::to('[email protected]')->send(new RoleUpdatedMail($admin));

it works and uses custom.css located in resources/views/vendor/mail/html/themes/custom.css

if I change to

Mail::to('[email protected]')->queue(new RoleUpdatedMail($admin));

it resorts to default.css in vendor directory

CodePudding user response:

Thanks u/Nathan from discord

could it be that the queue process needs to be reloaded queue:work will cache the code, so changes to it won't be picked up. try stopping / starting the process or use queue:listen . See if that makes a diff https://laravel.com/docs/9.x/queues#the-queue-work-command

Remember, queue workers, are long-lived processes and store the booted application state in memory. As a result, they will not notice changes in your code base after they have been started. So, during your deployment process, be sure to restart your queue workers. In addition, remember that any static state created or modified by your application will not be automatically reset between jobs.

  • Related