RoR: How to get an empty/new line in a plain text email
Asked Answered
U

1

6

I'm trying to get an empty line in a plain text email. I've tried with \n\n and with \r\n but in both cases, these characters are just displayed as normal text, instead of an empty line.

What am I doing wrong?

(I'm viewing a multipart email in plain text view in Mozilla Thunderbird.)

Thank you for any help! Tom

Unison answered 23/11, 2010 at 17:1 Comment(2)
It would help to see an example from your template and to know what the template is called. Also, your version of ruby and rails. It's not clear from your question if you're adding \n\n as four literal characters or if you mean you are using two newline characters.Jellybean
Yep, I was using \r\n instead of <%= "\r\n" %>Unison
S
7

In Ruby you have two sets of quoting rules, one for single quotes and the %q construct, and another for double quotes and %Q. Single quoting strings treats escape sequences as string literals and prints them as such. Double quoting a string will cause Ruby to process the escape sequences and insert the correct substitutions.

Subtangent answered 23/11, 2010 at 17:5 Comment(1)
Thanks! To sum it up, in the plain text code, it's not \r\n or <%= '\r\n' %> but <%= "\r\n" %>Unison

© 2022 - 2024 — McMap. All rights reserved.