Level 102
To get the best out of mails you should inline your css.
- Copy the exact parts of bootstrap you need into the mail template.
- Inline the css using something like https://github.com/fedeisas/laravel-mail-css-inliner
How would one go about sending a custom email? I have an ecommerce shop but would like to know how to customise the email sent to customers showing all they have bought. The below email works but I was wondering if there was a better way, as when it's sent the bootstrap link won't work until the customer allows it when they open the mail, and I can appreciate not all people are comfortable allowing all links:
@component('mail::message')
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
Thank you for your purchase. Please find the details of your order below:
<br>
<br>
<div class="row">
<div class="col-4">Product Name</div>
<div class="col-4">Price</div>
<div class="col-4">Quantity</div>
</div>
@foreach($emailItems as $item)
<div class="row">
<div class="col-4">{{ $item->name}}</div>
<div class="col-4">£{{ $item->price}}</div>
<div class="col-4">{{ $item->quantity}}</div>
</div>
@endforeach
To get the best out of mails you should inline your css.
Please or to participate in this conversation.