Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 292
TomDogg Avatar asked Nov 23 '10 17:11

TomDogg


People also ask

How do you insert a line break in plain text email?

You can insert a break into plaintext emails using {! BR()} .

How do I add a new line in plain text?

You must be using double quotes, and you use \r\n to make a new line.

How do you insert a new line in an email?

You can insert an HTML break <br> to force a new line.

How do I remove extra line breaks in plain text messages?

To do this, follow these steps: For Outlook 2010 and later versions: Open Outlook. On the File tab, select Options. In the Options dialog, select Mail. In the Message format section, clear the Remove extra line breaks in plain text messages check box. Select OK.

How to add a new line to an email?

If you are needing something more complex, then you can Generate the email using a hidden HtmlText Box. If you are comfortable with HTML. You can then add a <br/> tag to allow a new line. 11-09-2018 03:56 AM 11-09-2018 04:04 AM Char (10) is a Line feed. While Char (13) is a carriage return.

What is a plain text email?

Plain text emails are just that—plain text. They are the email equivalent to a letter written on a typewriter—no images, no pretty fonts, no hyperlinks. While they may not be nearly as attractive as HTML-based emails, they play a significant role in a well-rounded email marketing strategy.

Why can’t I see the plain text version of an email?

If an email client or app can only show the plain text version of an email, but no plain text version exists, most email clients will either show the raw HTML of the message or try to format it into plain text, both of which create a less than ideal experience for subscribers.


1 Answers

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.

like image 74
Mike Yockey Avatar answered Oct 29 '22 05:10

Mike Yockey