Laravel News Digest – Behind the Scenes

Published on by

I’ve been writing a weekly Laravel newsletter for 6 weeks now. Every week I try to share a personal story, Laravel tip, or some form of story that’s on my mind. I also include a list of posts, random web links, quotes, and other things. Here is a full archive if you want to see them.

In this post I wanted to share how I create these. At the start I created each one by hand, and by hand I mean I literally copy and pasted html tables all over the place and after I finally felt I had some sort of structure I would spend another hour or two making sure it worked in every mail client my devices support.

Design

I’m a big fan of minimal sites. I like the cleanliness and the focus on the fonts and words. More so than images and graphics. Of course with email you can’t get very fancy anyway or you could be in a world of hurt. I decided to go with a very clean response white and grey layout. I don’t have any stats to back this up but my thoughts are since I send these on a Sunday most of my readers will receive it on a mobile device, so having a minimal responsive theme was important.

For the template I used Zurb email templates and just went with their basic example. One nice thing I did come across however is that you can use custom fonts in email with a few caveats. You can use Google fonts, or you can use your own if you purchase the font and import into CSS. In my case I just picked two from Google, Lato and Oswald, and went with it. I’ll be honest I’m not sure how widely these are supported but they worked on all my devices, plus I used the good old fashioned fallbacks of Arial and Helvetica.

Another trick is to import the css file directly into the template. This way when you copy and paste into an inliner, it can pull styles from the source. Here is a simple way in blade:

<style type="text/css">
{{ include(public_path().'/css/newsletter.css') }}
</style>

HTML

I finally got fed up with the process of copy and pasting blocks of html tables and decided to make it better, and when I say better I mean better for me. You might think this is all dumb. :) The first step was getting away from HTML as much as possible. Nested tables are brutal without Dreamweaver and I’m not going down that path. I do love markdown and that’s what I wanted to write in. This gives me lots of benefits and my workflow is simple. Each week I create a new file and throughout the week I add to it anything I find interesting: notes, links, quotes, etc.

I then take the finished markdown file and parse it. I follow this structure in my file:

first section
 
--break--
 
second section
 
--break--
 
--posts-- <- This tag gets converted to a list of posts
 
--break--

With this I just “break” apart each section, run it through markdown, and then loop it in a view:

@section('content')
@foreach ($contents as $section)
@if (trim(strip_tags($section)) == '--posts--')
@include(theme_view('newsletter.inc.posts'))
@else
@include(theme_view('newsletter.inc.section-start'))
{{ $section }}
@include(theme_view('newsletter.inc.section-end'))
@endif
@endforeach
@stop

The finished parsed file is then ready for me to go through as many times as I need. I read and re-read these way more than I should. I pretend I’m a sniper with only one shot, so I strive to make it the best I can.

Once I’m comfortable with all the text then all that is left is to view source, copy and paste into the inliner, and schedule it for Sunday afternoon in my newsletter system.

Stats

To share a few stats so far I am getting around an 80% open rate with 1% unsubscribes. I’ve heard from a few sources that the bigger the list grows the open rate will typically decrease to around 50%, and the 1% is average. So I’m overall happy with my first few weeks into this experiment.

When I started this I never imagined the time and effort that I would put into it. Thinking about it now I should have just imported a list of this weeks posts, sent those, and be done. :)

Eric L. Barnes photo

Eric is the creator of Laravel News and has been covering Laravel since 2012.

Filed in:
Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
Tinkerwell

Version 4 of Tinkerwell is available now. Get the most popular PHP scratchpad with all its new features and simplify your development workflow today.

Visit Tinkerwell
Laravel Forge logo

Laravel Forge

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Forge
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
No Compromises logo

No Compromises

Joel and Aaron, the two seasoned devs from the No Compromises podcast, are now available to hire for your Laravel project. ⬧ Flat rate of $7500/mo. ⬧ No lengthy sales process. ⬧ No contracts. ⬧ 100% money back guarantee.

No Compromises
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Bacancy logo

Bacancy

Supercharge your project with a seasoned Laravel developer with 4-6 years of experience for just $2500/month. Get 160 hours of dedicated expertise & a risk-free 15-day trial. Schedule a call now!

Bacancy
LoadForge logo

LoadForge

Easy, affordable load testing and stress tests for websites, APIs and databases.

LoadForge
Paragraph logo

Paragraph

Manage your Laravel app as if it was a CMS – edit any text on any page or in any email without touching Blade or language files.

Paragraph
Lucky Media logo

Lucky Media

Bespoke software solutions built for your business. We ♥ Laravel

Lucky Media
Lunar: Laravel E-Commerce logo

Lunar: Laravel E-Commerce

E-Commerce for Laravel. An open-source package that brings the power of modern headless e-commerce functionality to Laravel.

Lunar: Laravel E-Commerce
DocuWriter.ai logo

DocuWriter.ai

Save hours of manually writing Code Documentation, Comments & DocBlocks, Test suites and Refactoring.

DocuWriter.ai
Rector logo

Rector

Your partner for seamless Laravel upgrades, cutting costs, and accelerating innovation for successful companies

Rector

The latest

View all →
Generate Code Coverage in Laravel With PCOV image

Generate Code Coverage in Laravel With PCOV

Read article
Non-backed Enums in Database Queries and a withSchedule() bootstrap method in Laravel 11.1 image

Non-backed Enums in Database Queries and a withSchedule() bootstrap method in Laravel 11.1

Read article
Laravel Pint --bail Flag image

Laravel Pint --bail Flag

Read article
Laravel Herd for Windows is now released! image

Laravel Herd for Windows is now released!

Read article
The Laravel Worldwide Meetup is Today image

The Laravel Worldwide Meetup is Today

Read article
Cache Routes with Cloudflare in Laravel image

Cache Routes with Cloudflare in Laravel

Read article