How does email work?

So you compose an email on your computer, using an email client like Outlook. You address it to someoneelse@theirdomain.com, and press Send. So what happens next?

1. Your email program sends your mail to the SMTP server where your account is. If you are sending mail to someone else whose mail account is on that server, go to step 7. Otherwise, keep reading.
2. The SMTP server breaks the address someonelse@theirdomain.com into two parts: someone else (the account name) and theirdomain.com (the domain). The SMTP server then contacts a DNS (domain name service)server, and asks for the IP address where theirdomain.com is located.
3. The DNS server sends the address back to the SMTP server.
4. The SMTP server then sends the email message to the SMTP server where theirdomain.com is located.
5. The second SMTP server delivers the email message to someone else’s account on the POP3 or IMAP server.
6. Someone else logs on to their computer and opens their email client. Their email client requests the POP3 or IMAP server to send all email from their account to their computer.
7. If you are sending email to someone whose account resides on the same set of mail servers, the SMTP server will simply direct the mail to the local POP3 or IMAP server, where it will be delivered to the appropriate account.