0

Some emails we're sending are getting clipped by gmail, so I'm trying to make them smaller. The biggest effect is when I run the email through a minifier like: http://www.willpeavy.com/minifier/

Now I'm trying to figure out how to minify the the emails I send with ActionMailer, that I send like:

NewsletterMailer.newsletter_email(@newsletter).deliver_later

I realize there are compression gems, but I'm not sure how to utilize those when ActionMailer is doing the rendering.

Any ideas?

99miles
  • 10,942
  • 18
  • 78
  • 123

1 Answers1

0

Perhaps you can try htmlcompressor gem?

Florent Morin
  • 842
  • 1
  • 10
  • 13
  • But I need ActionMailer to do it, right? I'm not simply passing a big string to be email, ActionMailer is doing the rendering. – 99miles Jan 12 '17 at 19:44
  • Render your email using ApplicationController.renderer.render(). Complete with [this answer](https://stackoverflow.com/questions/4916557/how-can-i-send-mail-with-rails-without-a-template). – Florent Morin Jan 12 '17 at 19:49
  • Florent, What about Rails 4? – 99miles Jan 12 '17 at 20:39