For me email was always an unknown, I understood what email was, but I never understood how it worked under the hood. This article provides a quick overview of email protocols, port numbers, and terms to help demystify things.
Let’s jump right in.
POP3 (post office protocol) - For checking and receiving email, once downloading a copy of an email from your mail server it’s usually removed from the server. This is normally only good for a single device.
IMAP (internet mail access protocol) - For checking and receiving email, once downloading a copy of an email from your mail server it is NOT usually removed from the server. This is good for having multiple devices sync up a mailbox.
SMTP (simple mail transfer protocol) - For sending email, not only is this used between your device and your mail server, but also used by your mail server to send the message along to the destination mail server.
- 110 (unencrypted connection to your mail server)
- 995 (encrypted connection to your mail server)
143 (unencrypted connection to your mail server)
993 (encrypted connection to your mail server)
25 (unencrypted connections to your mail server, don't use this it's old school)
465 (not an official port however some providers do use this for encrypted connections to your mail server)
587 (the official port to connect to your mail server, uses an encrypted connection)
MX (mail exchanger) record - A record on the DNS server that points to where the destination mail servers location.
SPF (sender policy framework) record - References mail servers that are authorised to send email on the behalf of the domain. The destinations mail server can check this to decide if the email was sent by an authorised mail server.
DKIM (domain key identified mail) record - Your mail server signs your email with a private key, the only way to verify the “signature” is with the corresponding public key, this public key is stored in DNS as a TXT record. The destinations mail server will try to verify the signature using the public key, if it fails it can automatically send the mail to the spam folder.
Email uses a text based format, similar to HTML. There’s a header section containing meta information (to, from, etc), and a body section containing the actual message content. Originally formatted in 7-bit ASCII text, MIME (multipurpose internet mail extensions) has allowed email to support different text formats including modern standards such as UTF-8.
If you view source on your email you can see how a message is formatted.
I hope this helps demystify things, and saves people a lot of time googling around for answers.