Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Mail Css Inliner Laravel Package

stayallive/laravel-mail-css-inliner

View on GitHub
Deep Wiki
Context7

Laravel Mail CSS Inliner

Latest Version Software License Build Status Total Downloads

Why?

Most email clients won't render CSS (on a <link> or a <style>). The solution is inline your CSS directly on the HTML. Doing this by hand easily turns into unmaintainable templates. The goal of this package is to automate the process of inlining that CSS before sending the emails.

How?

Using a wonderful CSS inliner package wrapped in a SwiftMailer plugin and served as a Service Provider it just works without any configuration. Since this is a SwiftMailer plugin, it will automatically inline your css when parsing an email template. You don't have to do anything!

Turns style tag:

<html>
    <head>
        <style>
            h1 {
                font-size: 24px;
                color: #000;
            }
        </style>
    </head>
    <body>
        <h1>Hey you</h1>
    </body>
</html>

Or the link tag:

<html>
    <head>
        <link rel="stylesheet" type="text/css" href="./tests/css/test.css">
    </head>
    <body>
        <h1>Hey you</h1>
    </body>
</html>

Into this:

<html>
    <head>
        <style>
            h1 {
                font-size: 24px;
                color: #000;
            }
        </style>
    </head>
    <body>
        <h1 style="font-size: 24px; color: #000;">Hey you</h1>
    </body>
</html>

Installation

This package requires at least Laravel 9 and PHP 8.

Begin by installing this package through composer. Require it directly from the CLI to take the last stable version:

composer require stayallive/laravel-mail-css-inliner

At this point the inliner should be already working with the default options. If you want to fine-tune these options, you can do so by publishing the configuration file:

$ php artisan vendor:publish --provider='Stayallive\LaravelMailCssInliner\ServiceProvider'

and changing the settings on the generated config/mail-css-inliner.php file.

Testing

composer test

Found a bug?

Please, let me know! Send a pull request or a patch. Questions? Ask! I will respond to all filed issues.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email me@alexbouma.me instead of using the issue tracker.

Credits

This is a fork from fedeisas/laravel-mail-css-inliner.

The forked package is greatly inspired, and mostly copied, from SwiftMailer CSS Inliner.

License

The MIT License (MIT). Please see License File for more information.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope