How to get a line break in a plain text email RoR?
-
26-09-2019 - |
Question
I'm sending a plain text email and was wondering how I add a line break to this. It's showing up on on the same line.
From: <%= @name %>
<%= @text %>
Thanks
Solution
\r\n
or if you're sending html email:
<br />
so:
From: <%= @name %> \r\n <%= @text %>
From: <%= @name %> <br /> <%= @text %>
OTHER TIPS
<%= "\r\n" %>
In double quotes and inside '<% %>'.
Otherwise it's considered as simple text.
I could be completely wrong, but isn't it a simple \n ?
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow