Welcome to another post about anything somewhat related to IT. A couple of weeks ago, I was guessing recruiters’ work email addresses (a typical Friday evening hobby of course) when I received an automated email back which informed me that the recipient could not receive my email since their domain did not accept emails from people outside of it. Or at least something to that effect… It made me think a bit and I realised that I should refresh myself on how emails are sent across the Internet so that’s why I’m writing about this. Let’s start with an overview of how an email is sent and received, as well as a brief explanation of SMTP.
A mail server is a generalised term to describe a system that collects, processes, and serves email. Without a mail server, you would only be able to send email messages to people in the same domain. The SMTP server is in your domain. This means you can reach it locally via an address similar to this: smtp.mydomain.com. SMTP stands for Simple Mail Transfer Protocol. It is a protocol that is used for sending and receiving emails over the Internet.
Now, if we are sending an email to someone that is not in our domain, we will need to find out where that domain’s MTA (Message Transfer Agent) server is. This is through DNS queries. An MTA server is just a server that decides where the email message should be delivered (think of it like a post office in the town the recipient lives in). They do this through querying MX records (which specify how to get from the MTA server to the mail server that the recipient accesses). Firstly, we need to figure out how to reach the target domain. Let’s look at how domain names are resolved into an IP address.
A DNS server is a server that translates domain names into IP addresses. What a lot of people refer to as a DNS server is actually called a DNS resolver. You pass the domain name to the DNS resolver and from there, that DNS resolver will query other DNS servers for information. Firstly, the DNS resolver queries the root server, and the root server will reply with the IP address of a TLD server. Then the resolver queries the TLD server, and the TLD server responds with the IP address of the domain’s authoritative name server. The resolver queries the authoratitive name server, which responds with the IP address of the origin server. Finally, the resolver queries the origin server which responds with the IP address of the MTA server of the target domain.
Once this has been done once, the DNS resolver will cache that IP address. This means that the DNS resolver won’t have to query any of the other servers again whenever you want to interact with that domain.
Once the DNS resolver finds the IP address of the MTA server, the MTA server queries the MX records of the domain in order to find out where the recipient’s mail server is and sends it to the correct mail server. Let’s take a look at how that email ends up in the recipient’s inbox from the mail server.
POP vs IMAP
POP3 downloads emails from the mail server to the user’s computer and then deletes the emails on the mail server.
IMAP4 allows the user to access, read, and write emails on the mail server through an email client (such as Thunderbird for example).
POP is quite old and is designed for retrieving email messages from one device. IMAP allows you to check your email from more than one device since the email messages are not deleted.
This was a morning’s worth of reading and researching and learning. Time well spent! I hope you learnt something new or enjoyed reading this. I will make a new post next week. Until then!