Now let's examine the second scenario. A more complex situation arises when the recipients email server is located outside the local network (So the sender is email@example.com and the recipient is firstname.lastname@example.org). In this case, the SMTP server needs to locate the recipient's email server.
You might recall that when we discussed the HTTP protocol, your web browser communicates with the DNS server of your ISP to locate the IP address of the web server hosting the web site you want to view.
When sending an external email message, something very similar happens. Your SMTP server will look at the extension of the recipient address, in this case yahoo.com. It will then communicate with the ISP's DNS server to locate the IP Address of yahoo.com's Mail Server. Remember, the IP address identifies the location of the destination server (yahoo.com).
Once we have the destination IP address, the SMTP server will connect with the destination email server. At this point, the destination server will run a variety of spam filters to ensure the message is not junk mail. Once it is determined the message is safe for delivery, the destination server will keep the message in Joe's email store until Joe connects to his email providers email server and downloads the message, using either POP3 or IMAP.