Why is it so expensive to send an email?
Explains why sending email at scale costs money: IP reputation, deliverability, bounce handling and anti-spam rules, not the SMTP request itself.
Extract
Sending an email is essentially the same as making an HTTPS request. You open a TCP connection to port 25, you do a little SSL handshake, and you send some data through. Most personal computers out there can easily do this thousands of times per second, so how can companies charge $15 to send 1000 emails?! Why do I need some 3rd party company involved at all?! I used to work at Google specifically on GMail, and nothing from my little corner of the product on the “tabbed inbox” team led me to a clear answer... Unfortunately for me, I was determined to figure it out for myself! I mostly program with Haskell, and I call C code as necessary for things like OpenSSL and SQLite. I already had a setup for making HTTPS requests from my Haskell code with OpenSSL. I had code for working with HTTP 1.1 messages. How hard could it be to adapt this to email? To my surprise, it turns out that the actual “sending” part is not that hard. The real problem was ultimately out of my hands... Simple Mail Transfer Protocol Just like the original plaintext Hypertext Transfer Protocol (HTTP 1.1), there is a correspondingly goofy plaintext protocol for sending emails called Simple Mail Transfer Protocol (SMTP). The original version of the protocol involves sending a bunch of messages back and forth and back and forth between the sender and receiver. It looks kind of like a little conversation. Here is an example where I start my messages with keywords like HELO and MAIL FROM and the receiver starts her messages with status codes like 220 and 250: (Evan opens the TCP connection) 220 mail.example.com HELO evancz.dev 250 Hello evancz.dev, I am glad to meet you MAIL FROM:devnull@evancz.dev 250 OK RCPT TO:alice@example.com 250 OK DATA 354 End data with <CR><LF>.<CR><LF> From: "Evan from Elm" devnull@evancz.dev To: "Alice from Cryptography" alice@example.com Date: Wed, 21 Oct 1981 8:33:40 +0100 Subject: Big Fan! Hello Alice from Cryptography, I loved your collaboration with Rivest, Shamir, and Adleman in 1977. I have been eagerly awaiting the invention of email, so that I could express my admiration through this plaintext transfer protocol! Best, Evan from Elm . 250 OK: queued as 12345 QUIT 221 Bye (Alice closes the connection) So to send a single email, you originally had to do SEVEN roundtrips! And TLS did not exist at that time, so you did not even get any encryption after all those roundtrips! That said, it is not that hard to send and receive a bunch of goofy plaintext, so I …