How to Send Tailwindcss-Styled Emails With Ruby on Rails 7

Have you ever tried to create a good-looking email design from scratch?

Or how about using TailwindCSS to write your email layouts?

Well, if you did, you've probably failed. A lot.

And it's safe to say reminding you about it is not a good way to make friends.

But! I'm here to help.

Let me show you how I create beautiful email templates in just a few minutes and how I use them in my Rails projects.

Creating good-looking emails should be easy

Instead of settling for plain-text emails or half-assed HTML designs, we should be able to come up with a good-looking design and not spend ages working on it.

And here's why:

  • Good design makes you look professional
  • It's not that hard to create amazing emails if you know how
  • Your SaaS can sell more products
  • Your customers will trust you more

Fortunately, this is super easy to do, and you'll be done in no time.

Here are your options for creating good-looking emails across email clients.

Option 1: Do it yourself

I want to mention this option because... well... it's doable. But I wouldn't recommend it.

You basically start from nothing, learn all about email design (and all the little quirks that email client has), build your layout, and test it (with an email testing service).

I don't recommend this option because it takes a lot of time, and you could probably use that time to do other things.

But it's an option. For sure.

Option 2: Done for you

If you ask me, this one is probably the best option if you value your time.

You purchase a done-for-you email kit/template from a design service (or designer) and use it in your Rails project.

The good thing about it is that these templates are already tested, so you don't have to spend your time on that.

Option 3: TailwindCSS design

This third option is a hybrid between the DIY option and the done-for-you.

Just like you would use TailwindCSS to create your browser layouts, you can use it to create email templates.

But this won't work in Rails out of the box. Unless you create your layouts using HTML tables and use something like the premailer-rails gem to inline your CSS (I haven't tried this approach).

The way I've done it is by using Maizzle. They give you a nice starter template, and a Node project, so you can build your template quickly.

When you're done, you can export the HTML and copy/paste it into your Rails mailer layout.

If you want to see the video I've made or read the full article, check out the full guide here.