# \[OT\] Email line separator

**URL:** <https://www.ruby-forum.com/t/ot-email-line-separator/71776>\
**Category:** Rails\
**Created:** [February 22, 2006, 1:16pm UTC](https://www.ruby-forum.com/t/ot-email-line-separator/71776 "2006-02-22T13:16:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Norman\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ed8c4c/32.png) [@Norman\_T](https://www.ruby-forum.com/u/Norman_T)\
**Post date:** [February 22, 2006, 1:16pm UTC](https://www.ruby-forum.com/t/ot-email-line-separator/71776/1 "2006-02-22T13:16:53Z")

</div>

What line separator do you use when composing emails?

1. \n
2. \r\n
3. \r

Is there a ‘official’ line separator for emails (rfc-document?)?

What separator is the most compatible between Windows, OS X and Linux?

–  
Norman T.

[http://blog.inlet-media.de](http://blog.inlet-media.de)

---

<div class="post-metadata">

**Author:** ![Norman\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ed8c4c/32.png) [@Norman\_T](https://www.ruby-forum.com/u/Norman_T)\
**Post date:** [February 22, 2006, 5:12pm UTC](https://www.ruby-forum.com/t/ot-email-line-separator/71776/2 "2006-02-22T17:12:10Z")

</div>

Norman T. wrote:

> What line separator do you use when composing emails?
> 
> 1. \n
> 2. \r\n
> 3. \r
> 
> Is there a ‘official’ line separator for emails (rfc-document?)?

CRLF is the official line separator. See RFC822 and RFC2822. Quoting  
from the latter:

Messages are divided into lines of characters. A line is a series of  
characters that is delimited with the two characters carriage-return  
and line-feed; that is, the carriage return (CR) character (ASCII  
value 13) followed immediately by the line feed (LF) character (ASCII  
value 10). (The carriage-return/line-feed pair is usually written in  
this document as “CRLF”.)

Now, however, this only applies if you’re sending the message directly  
to an MTA over SMTP. If you’re, e.g., piping to /usr/bin/sendmail, the  
line seperator is just LF (sendmail converts the LF to CRLF before  
sending it on)

---

<div class="post-metadata">

**Author:** ![Norman\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ed8c4c/32.png) [@Norman\_T](https://www.ruby-forum.com/u/Norman_T)\
**Post date:** [February 23, 2006, 11:56am UTC](https://www.ruby-forum.com/t/ot-email-line-separator/71776/3 "2006-02-23T11:56:59Z")

</div>

Am Mittwoch, den 22.02.2006, 10:48 -0500 schrieb Anthony DeRobertis:

> CRLF is the official line separator. See RFC822 and RFC2822. Quoting  
> to an MTA over SMTP. If you’re, e.g., piping to /usr/bin/sendmail, the  
> line seperator is just LF (sendmail converts the LF to CRLF before  
> sending it on)

Hmmm, so it doesn’t make any difference what line separator to use. But  
i know that some of the rails generated emails have defect line breaks  
in some mail readers. Is there nothing i can do?

–  
Norman T.

[http://blog.inlet-media.de](http://blog.inlet-media.de)

---

<div class="post-metadata">

**Author:** ![Norman\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ed8c4c/32.png) [@Norman\_T](https://www.ruby-forum.com/u/Norman_T)\
**Post date:** [February 23, 2006, 9:18pm UTC](https://www.ruby-forum.com/t/ot-email-line-separator/71776/4 "2006-02-23T21:18:06Z")

</div>

Norman T. wrote:

> Hmmm, so it doesn’t make any difference what line separator to use.

Sure it does. Depending on what interface rails is using (no idea  
personally), you must use either CRLF or LF.

> But i know that some of the rails generated emails have defect line  
> breaks in some mail readers. Is there nothing i can do?

Make sure the final email contains CRLF.
