The two mages returned from their break and the Admin continued his explanation of the Unix mail system.
“There are a few different ways a mage can read his mail on a Unix system. The first, and simplest, is with the
“Here’s what it looks like when the mage has no mail:”
$ mail No mail for joe
“And here’s what it looks like when there’s actually mail:
$ mail Mail version 8.1 6/6/93. Type ? for help. "/var/spool/mail/joe": 1 message 1 new >N 1 email@example.com Sun Dec 11 11:54 14/565 "hi" N 2 firstname.lastname@example.org Sun Dec 11 12:26 14/604 "hi again" &
“The ampersand (&) is the prompt in the mail shell. Above that, mail tells us what messages the mage has in their inbox.
N stands for “new” and the number next to it is that messages position in the inbox.
“To read a message, we simply type the messages number at the prompt:”
& 1 Message 1: From email@example.com Sun Dec 11 12:25:59 2005 X-Original-To: joe Delivered-To: firstname.lastname@example.org To: email@example.com Subject: hi Date: Sun, 11 Dec 2005 12:25:59 -0500 (EST) From: firstname.lastname@example.org hello, this is a test message &
“To delete a message, use the
& d 1
“To quit, type
& q $
“You can also send new mail and reply to messages with the
Acre said, “So basically, the
less manually in the mailbox.”
“OK, but to use the
“Yes, that’s correct.” The Admin replied.
Acre said, “So what if the mage is at their house or away from the Tower?”
“Mages can still check their mail, but they’ll need help from some daemons.”
“What are the differences?”, Acre asked.
popd (also known as
popd3, since that’s the current version of the protocol) is more simple than
imapd. It takes less resources in the Tower to use, and has been around longer.
imapd, on the other hand, might be more complex, but provides more features in return.”
“What kind of features?”
“Well, when a mage checks their mail with
pop3, all the mail is transferred to where the mage is, and is then removed from the Towers mail department. If the mage somehow loses their mail, it’s lost forever — the Tower has no record of it anymore.
imap can fix that problem by allowing the mage to check their mail from a different location while still having the mail stored at the Tower.
imap can also handle shared mailboxes and multiple mailboxes easily. While it is possible to leave mail at the Tower using
pop, it doesn’t work as smoothly as
imap and still creates a 2nd copy at the mage’s location, taking up space.”
Acre asked, “I see. So
imap is more preferred?”
“It’s very easy for a Tower to use both
imap and let the mage decide. From the mage’s perspective,
imap provides more features and is really the better choice — unless they’re in a situation where
pop is the only option.”
“So how does each one work?” Acre asked.
The Admin replied, “The mage will have to set up a mail program wherever they are. Once he tells the mail program some information about himself, the Tower to get the mail from, and whether to use
imap, the program will do the rest of the dirty work. We can actually see some of that work here.
“Here’s what a
pop session looks like:”
$ telnet pop3.unixmages.com 110 Trying 127.0.0.1...Connected to pop3.unixmages.com Escape character is '^]'. +OK POP3 ready. user joe +OK pass p4ssw0rd +OK Logged in. list 1 44582 38183 16574 15348 quit +OK Logging out.
“And here’s an
$ telnet imap.unixmages.com 143 Trying 127.0.0.1... Connected to imap.unixmages.com * OK IMAP ready. a1 login joe p4ssw0rd a1 OK Logged in. a2 select INBOX * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) * OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft \*)] Flags permitted. * 26 EXISTS * 0 RECENT * OK [UIDVALIDITY 1086774200] UIDs valid * OK [UIDNEXT 10400] Predicted next UID a2 OK [READ-WRITE] Select completed. a3 logout * BYE Logging out a3 OK Logout completed.
“As you can see, they work in two completely different ways.” the Admin said.”
“What’s all that
telnet stuff?” Acre asked.
telnet is a spell to let us talk to Towers remotely.
imap.unixmages.com are the two places we’re talking to. The number at the end is a port. We’ll learn about ports later — but just for now, remember that
143 are the port numbers for popd and imapd.”
imapd — these two daemons allow a mage to connect to a remote Tower to check their mail. Basically, what they’re doing is teleporting over to the Tower and allowing the mage’s mail program to use fancy versions of the
less spells to read those text files in their mailbox. Right?”
“You got it.” The Admin said.
Acre said, “OK, I get it. Now what about mail services like gmail and yahoo that let you check your mail over the web. How do those work?”
“Basically the same way as using a full mail program. Those services still use mailboxes and
imapd, but they output all the mail to a webpage.”
“Got it.”, Acre said, “Now how does someone send me mail and how does it get to my mailbox?”
“We’ll go over that topic next.”