Email – How to Set Up Local Mail Retrieval and Delivery

email

$ mail
No mail for lazer
$
  • I am able to send mails using mail.
  • I have unread mails in my inbox as I can see in Outlook.

Why doesn't mail show me my mails? How can I make mail fetch them?

Best Answer

Traditionally, unix mail is delivered right to your machine (because if your email address is lazer@machine.example.com, surely you have a shell account on machine.example.com). It is usually delivered in a file called /var/mail/lazer or /var/spool/mail/lazer, though a mail delivery agent may put it somewhere else. This still happens on unix mail servers, but nowadays most users don't have direct access to mail servers. Local mail (e.g. from cron jobs) is normally delivered in this way.

Nowadays, typically, the mail is delivered on a server somewhere, and your only access to this server is a mail retrieval protocol, typically POP or IMAP. Microsoft has a proprietary protocol to talk to its mail server (Exchange), and accessing Exchange with anything but Outlook can be difficult (Exchange has an optional modules for POP and IMAP, but they're not always enabled). Most ISPs and mail providers offer both POP and IMAP access; in an all-Microsoft corporate environment you might be stuck with Exchange.

To read your mail under unix, you have three choices:

  • Arrange for the mail server to forward the mail to your computer. This is reasonable only if your computer is always on and connected to the Internet: you take responsibility for any failure, and must set things up properly to handle bounces, spam attempts, virus attacks, etc. Then your mail will arrive in the traditional unix way.

  • Fetch your mail from the server at regular intervals. The usual tool for this is fetchmail. It queries a POP or IMAP server and delivers the mail either using the normal system delivery mechanism or directly to a file of your choice. What protocol to use, what server to query, what username and password to pass, and so on will be found in your Outlook settings. Depending on how you configure fetchmail, a copy of the downloaded mails may or may not remain on the server.

  • Make your mail client itself retrieve the mail from the server using POP or IMAP. Most unix mail clients that are more advanced than the ancient /bin/mail can do this. Again, the parameters to access the server will be found in your Outlook settings. Outside the unix world (e.g. with Outlook) this is typically the only possible mode of operation.

Related Question