Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS not loading in Laravel 5 sent email

I have included all Bootstrap 3 CSS files and other project related JS and CSS files with unique folder names inside the public folder. Here's an example of the structure:

public/pnotify
public/bower_components/bootstrap
public/ckeditor

I have included all these JS and CSS links with exact path on main template and everything loads correctly through out the project, but when I give a Blade file as view for Laravel 5 mail. The CSS doesn't load and everything is messed up in the received email, while the same Blade file is rendered accurately within project. Is it because I haven't implemented asset management of Laravel and mail system of Laravel loads CSS only from assets or I am missing something? Please some one clarify.

like image 895
Sumit Avatar asked May 23 '15 18:05

Sumit


Video Answer


1 Answers

You can link external CSS files in an email, but most likely they will be blocked by the email clients for security reasons. So you'll need to inline the CSS inside your email templates for them to work.

You can try using the following package to help make it easier:

Laravel Mail CSS Inliner

like image 165
Bogdan Avatar answered Sep 29 '22 07:09

Bogdan