Remix.run Logo
tiborsaas 6 hours ago

> We see that that’s a quite a long line. Mail servers don’t like that

Why do mail server care about how long a line is? Why don't they just let the client reading the mail worry about wrapping the lines?

direwolf20 5 hours ago | parent | next [-]

SMTP is a line–based protocol, including the part that transfers the message body

The server needs to parse the message headers, so it can't be an opaque blob. If the client uses IMAP, the server needs to fully parse the message. The only alternative is POP3, where the client downloads all messages as blobs and you can only read your email from one location, which made sense in the year 2000 but not now when everyone has several devices.

fluoridation 4 hours ago | parent [-]

Hey, POP3 still makes sense. Having a local copy of your emails is useful.

direwolf20 4 hours ago | parent | next [-]

If you want it to be the only copy and not sync with anything

POP3 is line–based too, anyway. Maybe you can rsync your maildir?

fluoridation 3 hours ago | parent [-]

I just read it mainly in one place and through the web interface when I have to.

dylan604 2 hours ago | parent [-]

If your "in one place" reader is still open and downloading messages then there will be no messages to view in the web interface when you have to.

fluoridation 25 minutes ago | parent | next [-]

There will, because my client doesn't delete the messages from the server when it downloads them.

skydhash 35 minutes ago | parent | prev [-]

POP3 is more for reading and acting on your email in one place (taking notes, plan actions, discard and delete,…). No need to consume them on other devices as you’ve already extracted the important bits.

I use imap on my mobile device, but that’s mostly for recent emails until I get to my computer. Then it’s downloaded and deleted from the server.

ahoka an hour ago | parent | prev [-]

But it's more akin to consuming a message queue. You have fetched it, it's gone.

GMoromisato 16 minutes ago | parent | prev | next [-]

I don't think kids today realize how little memory we had when SMTP was designed.

For example, the PDP-11 (early 1970s), which was shared among dozens of concurrent users, had 512 kilobytes of RAM. The VAX-11 (late 1970s) might have as much as 2 megabytes.

Programmers were literally counting bytes to write programs.

layer8 6 hours ago | parent | prev | next [-]

Mails are (or used to be) processed line-by-line, typically using fixed-length buffers. This avoids dynamic memory allocation and having to write a streaming parser. RFC 821 finally limited the line length to at most 1000 bytes.

Given a mechanism for soft line breaks, breaking already at below 80 characters would increase compatibility with older mail software and be more convenient when listing the raw email in a terminal.

This is also why MIME Base64 typically inserts line breaks after 76 characters.

SoftTalker 3 hours ago | parent [-]

In early days, many/most people also read their email on terminals (or printers) with 80-column lines, so breaking lines at 72-ish was considered good email etiquette (to allow for later quoting prefix ">" without exceeding 80 characters).

bjourne 10 minutes ago | parent [-]

One of the technical marvels of the day were mail and usenet clients that could properly render quoted text from infinite, never ending flame wars!

jcynix 3 hours ago | parent | prev | next [-]

"BITNET was a co-operative university computer network in the United States founded in 1981 by Ira Fuchs at the City University of New York (CUNY) and Greydon Freeman at Yale University."

https://en.wikipedia.org/wiki/BITNET

BITNET connected mainframes, had gateways to the Unix world and was still active in the 90s. And limited line lengths … some may remember SYSIN DD DATA … oh my goodness …

https://www.ibm.com/docs/en/zos/2.1.0?topic=execution-systsi...

liveoneggs 5 hours ago | parent | prev | next [-]

This is how email work(ed) over smtp. When each command was sent it would get a '200'-class message (success) or 400/500-class message (failure). Sound familiar?

telnet smtp.mailserver.com 25

HELO

MAIL FROM: me@foo.com

RCPT TO: you@bar.com

DATA

blah blah blah

how's it going?

talk to you later!

.

QUIT

Telemakhos 4 hours ago | parent | next [-]

This brings back some fun memories from the 1990s when this was exactly how we would send prank emails.

kstrauser an hour ago | parent | next [-]

Yep! And also, if you included a blank line and then the headers for a new email in the bottom of your message, you could tell the server, hey, here comes another email for you to process!

If you were typing into a feedback form powered by something from Matt’s Script Archive, there was about a 95% chance you could trivially get it to send out multiple emails to other parties for every one email sent to the site’s owner.

fix4fun 2 hours ago | parent | prev [-]

That was nice part of 1990s - many systems allow for funny things ;)

1718627440 3 hours ago | parent | prev | next [-]

For anyone who wants to try this against a modern server:

    openssl s_client -connect smtp.mailserver.com:smtps -crlf
    220 smtp.mailserver.com ESMTP Postfix (Debian/GNU)
    EHLO example.com
    250-smtp.mailserver.com
    250-PIPELINING
    250-SIZE 10240000
    250-VRFY
    250-ETRN
    250-AUTH PLAIN LOGIN
    250-ENHANCEDSTATUSCODES
    250-8BITMIME
    250-DSN
    250-SMTPUTF8
    250 CHUNKING

    MAIL FROM:me@example.com
    250 2.1.0 Ok

    RCPT TO:postmaster
    250 2.1.5 Ok

    DATA
    354 End data with <CR><LF>.<CR><LF>

    Hi
    .
    250 2.0.0 Ok: queued as BADA579CCB

    QUIT
    221 2.0.0 Bye
xg15 3 hours ago | parent | prev [-]

I like how SMTP was at least honest in calling it the "receipt to" address and not the "sender" address.

Edit: wrong.

1718627440 3 hours ago | parent [-]

RCPT TO specifies the destination (recipient) address, the "sender" is what is written in MAIL FROM.

However what most mail programs show as sender and recipient is neither, they rather show the headers contained in the message.

xg15 3 hours ago | parent [-]

Ah, sorry. You're right.

citrin_ru 6 hours ago | parent | prev | next [-]

Back in 80s-90s it was common to use static buffers to simplify implementation - you allocate a fixed size buffer and reject a message if it has a line longer than the buffer size. SMTP RFC specifies 1000 symbols limit (including \r\n) but it's common to wrap around 87 symbols so it is easy to examine source (on a small screen).

thephyber 6 hours ago | parent | prev | next [-]

The simplest reason: Mail servers have long had features which will send the mail client a substring of the text content without transferring the entire thing. Like the GMail inbox view, before you open any one message.

I suspect this is relevant because Quoted Printable was only a useful encoding for MIME types like text and HTML (the human readable email body), not binary (eg. Attachments, images, videos). Mail servers (if they want) can effectively treat the binary types as an opaque blob, while the text types can be read for more efficient transfer of message listings to the client.

Pinus 6 hours ago | parent | prev | next [-]

As far as I can remember, most mail servers were fairly sane about that sort of thing, even back in the 90’s when this stuff was introduced. However, there were always these more or less motivated fears about some server somewhere running on some ancient IBM hardware using EBCDIC encoding and truncating everything to 72 characters because its model of the world was based on punched cards. So standards were written to handle all those bizarre systems. And I am sure that there is someone on HN who actually used one of those servers...

jcynix 3 hours ago | parent | next [-]

EBCDIC wasn't the problem, this was (part of) the problem:

https://www.ibm.com/docs/en/zos/2.1.0?topic=execution-systsi...

And BITNET …

kstrauser an hour ago | parent [-]

> EBCDIC wasn't the problem

Wake up, everyone! Brand new sentence just dropped!

tiborsaas 5 hours ago | parent | prev [-]

Thanks, I really expected a tale from the 70's, but did not see punch cards coming :)

jibal 5 hours ago | parent [-]

The influence of 80 column punch cards remains pervasive.

4 hours ago | parent [-]
[deleted]
josefx 5 hours ago | parent | prev | next [-]

RFC822 explicitly says it is for readability on systems with simple display software. Given that the protocol is from 1982 and systems back then had between 4 and 16kb RAM in total it might have made sense to give the lower end thin client systems of the day something preprocessed.

sumtechguy 4 hours ago | parent [-]

Also it is an easy way to stop a denial of service attack. If you let an infinite amount in that field. I can remotely overflow your system memory. The mail system can just error out and hang up on the person trying the attack instead of crashing out.

fluoridation 4 hours ago | parent [-]

Surely you don't need the message to be broken up into lines just for that. Just read until a threshold is reached and then close the connection.

codingdave 6 hours ago | parent | prev [-]

Keep in mind that in ye olden days, email was not a worldwide communication method. It was more typical for it to be an internal-only mail system, running on whatever legacy mainframe your org had, and working within whatever constraints that forced. So in the 90s when the internet began to expand, and email to external organizations became a bigger thing, you were just as concerned with compatibility with all those legacy terminal-based mail programs, which led to different choices when engineering the systems.

liveoneggs 5 hours ago | parent [-]

This is incorrect

kstrauser an hour ago | parent [-]

Are you certain? Not OP, but a huge chunk of early RFCs was about how to let giant IBM systems talk to everyone else, specifying everything from character sets (nearly universally “7-bit ASCII”) to end of line/message characters. Otherwise, IBM would’ve tried to make EBCDIC the default for everything.

For instance, consider FTP’s text mode, which was primarily a way to accidentally corrupt your download when you forgot to type “bin” first, but was also handy for getting human readable files from one incompatible system to another.