Ruby on Rails November 20, 2020

Premailer or Bootstrap-email?

Natalio Krasnogor @nkrasnogor

Colleagues, I built a saas product on Rubi on Rails 5.2 and boostrap 4.5 for (parts of the) styling.
I am wandering what would be your recommendation for styling emails?
I was previously using premailer but i recently came across Bootstrap-email.
Any reasons why to prefer one over the other? Post/cons?
Thanks!

  1. 1

    Any reason you can't use an external email service and deliver via API? A lot of these tools offer generous free teirs, and easy to use templates.

    I've integrated SendGrids API into a Rails app fairly quickly.

    1. 1

      I am using, indeed, one (Mailgun in my case). But I need to be able to properly style my emails following the design guidelines of the app, and for that I need the styles to be inlined. I can see two main gems for this: premailer and bootstrap-email.
      So I was wondering if people have experience with both and which they prefer and why....

      1. 1

        For sure, I totally understand that you want your emails to match your app's styles. I think though that you would still be able to do that with an external tool. Of course you can't reuse any variables or styles from your app's CSS in your email styles directly, but honestly, can you do that anyways?

        1. 1

          Yes, you can (to a large degree) with either of those gems (still requires tweeking though). The external templates are good for simple cases but if your app sends lots of different kinds of notifications, files, data, etc via emails then it becomes really troublesome to manage those external templates. From within the app you can more readily (a) reuse. and (b) version control.

Recommended Posts