Corey Quillen
Corey Quillen

Reputation: 1576

Add line breaks to Rails text email without double spacing?

How can I add line breaks to a plain text email in Rails 4 without adding extra spacing?

For example:

Email template: email.text.erb

Thank you for contacting<%= "\r\n" %>
us today.  We appreciate<%= "\r\n" %>
your business.

This is what the email looks like:

Thank you for contacting

us today.  We appreciate

your business.

I want it to look like this (single spacing):

Thank you for contacting
us today.  We appreciate
your business.

I've tried with and without the <%= "\r\n" %> entries but nothing works. Any help will be greatly appreciated.

Upvotes: 0

Views: 257

Answers (2)

Corey Quillen
Corey Quillen

Reputation: 1576

I am using SendGrid to deliver emails. I just discovered that they have a setting to automatically convert text emails into html. When I turn this setting off in SendGrid, the formatting in email.text.erb appears in the email unchanged.

Upvotes: 2

Alex Tonkonozhenko
Alex Tonkonozhenko

Reputation: 1574

Try not to write <%= "\r\n" %>, just

Thank you for contacting
us today.  We appreciate
your business.

Upvotes: 0

Related Questions