SMTP components or Why sending emails is a rocket science

updated by Nikita Chernyi in SMTP (RSS)

First published on 2022-11-10.

Hey, Wanna know the biggest scam you can get in the email world (apart from “email is a decentralized communication protocol”)?

Simple Mail Transfer Protocol.

Simple, huh? They lied. It’s damn rocket science!

I’m just trying to compile a note about what I found while working on postmoogle (opens in new tab).

Let me just throw some smtp-related tags and see if you can correctly handle at least one of them: MUA, MSA, MTA, MDA.

Do you recall something? I bet you didn’t. That’s a description of the high-level flow on how email “Where is my order” sent from your personal@email.com to support@amazon.com (of course, all addresses are just examples. Not sure if they even exist).

Digging through Wikipedia (opens in new tab):

there are some other things, but they’re a bit out of the scope of how SMTP works

Still don’t get it? Ok, let me try to translate those M*As:

So, how it works?

MUA (your mail client) sends a request to your email’s MSA with the email you sent, and MSA forwards/delivers it to your recipient’s MSA.

Wait, where are all those MTA, MDA, M*A things?

Well, they are part of the same “email server” program now. Nowadays an “email server” can be only one program that runs with different input params:

$ emailserver --be-msa
$ emailserver --be-mta
$ emailserver --be-mda
# ...

And to understand that, you have to dig through Wikipedia, try to implement every component, understand that you have a horrifying mess of things, dig through Wikipedia again, catch zen and implement everything as 1 program even without --be-X params.

Yeah, that’s how postmoogle (opens in new tab) was implemented - I didn’t have a clue about how email actually works.

Now I have :D


A diary of a sweet summer child going insane and becoming a cynical Nolisting enjoyer.

Too much SMTP for today? See AI, Misc for a change

llms.txt