How to set maximum line length for Rails Slim email templates?

I use Slim as a template for my HTML email. When the nice mode is turned off during production, it puts all the HTML in one line. When emails go through Sendgrid , a line break is entered at the 998th character that breaks the HTML. Sendgrid does this according to the RFC email distribution.

How can I turn off nice mode when rendering email, tell Slim how to keep the maximum line length, or introduce strict line breaks?

+4
source share
2 answers

Adding a few of them

 = "\r\n" 

all over the email template solved the problem.

+5
source

Just add the data-force-encoding="✓" attribute to the body tag. This will force Rails to send the email as quoted for printing (the trick is to use the UTF8 char). See: https://github.com/slim-template/slim/issues/123

+2
source

All Articles