Setting Up E-mail

Last updated: December 15, 2000
Development stage: Beta

E-mail is probably one of the most important parts of using the Internet, so it only makes sense that Linux lets you use your precious e-mail.

Your ISP probably uses a POP3 server for your e-mail. The program pine is an e-mail client that enables you to read, send, reply, sort, delete, forward, and do a lot more to your e-mail. That's what I use, although you might want to try other mail programs such as mutt or elm.

Then again, you may also have IMAP available. IMAP keeps the mailbox on the ISP so you don't really have to download it to your box, but read it and allow yourself to make changes that are saved onto the server later on. To my knowledge, not a lot of ISPs do this, but your company might use it. In a lot of ways, it's a lot more convenient.

Downloading Your E-mail

To download whatever e-mail you have onto your system, you should use a program called fetchmail. It handles POP3 (probably what you use), IMAP, and a bunch of other protocols for e-mail transfer. For IMAP you probably want to use pine.

Set Up Your ".fetchmailrc" File

To use fetchmail, you should set up a file in your home directory called .fetchmailrc. It probably doesn't exist yet, so create it by typing pico ~/.fetchmailrc. Here's what mine looks like:

poll pop.netaddress.com proto POP3 fetchall

That will tell fetchmail to check the server pop.netaddress.com using the POP3 protocol. Since USA.net/NetAddress marks the messages as already being seen, I have to put in the "fetchall" part to tell it to get the messages no matter what.

Note that all the options for the server are on one line.

If you want to, you can also put your password in the .fetchmailrc file. Use the "pass" option. For example, if my password were "barrel", my sample .fetchmailrc file would look like this:

poll pop.netaddress.com proto POP3 pass barrel fetchall

In the event that your password has strange characters in it, you will want to put it in quotation marks. I would not recommend putting your password in your .fetchmailrc file, because if anybody ever gets the root account on your system, they will also be able to get your password. If you're not worried about the security of your machine, and just want to get your mail with the least hassle possible, then include it.

Fill in your .fetchmailrc file with the options you need to (there are tons more options that you can view by typing man fetchmail). You should have at least the "poll" and the "proto" fields. Then save the file and exit. Once you're back at the prompt, type chmod 600 ~/.fetchmailrc.

Using Fetchmail

Now all you have to do is type fetchmail and it should prompt you for the password. It takes your username on your own machine and uses it as the login name for the account on the POP3 server. If you need to change it to get your e-mail, add the "-u" flag and then your username. So if I had to use the username jgo instead of joshuago to download my mail, my fetchmail command line would be fetchmail -u jgo instead. If you want to keep it in your .fetchmailrc file, use the option user [name].

Reading Mail

There are four major programs that I know of that you can use to read your e-mail. One is pine, the second is mutt, the third is mail, and the last is elm. I have experience through normal use only with PINE (although I like Mutt a little bit too), so that's what I'll give instructions on.

Start up PINE by typing pine at the command prompt (it works in an xterm window as well). If this is the first time that you've started up PINE, you'll have to go through the setup procedure by typing the following keys once you're in the main PINE menu: S, C. This will take you to a screen that looks like this:

  PINE 3.95   SETUP CONFIGURATION                  Folder: INBOX  42 Messages

personal-name            = <Put your name here>
user-domain              = <Part after the @ in the return address>
smtp-server              = <SMTP server>
nntp-server              = <News Server>

The rest you can leave blank if you want. This is what mine looks like:

  PINE 4.21   SETUP CONFIGURATION                 Folder: INBOX  539 Messages 
 
personal-name            = Joshua Go                      
user-domain              = local.net                                      
smtp-server              = mail.local.net                      
nntp-server              = <No Value Set>
inbox-path               = <No Value Set: using "inbox">
incoming-archive-folders = <No Value Set>
pruned-folders           = <No Value Set>
default-fcc              = <No Value Set: using "sent-mail">
default-saved-msg-folder = <No Value Set: using "saved-messages">
postponed-folder         = <No Value Set: using "postponed-msgs">
read-message-folder      = <No Value Set>
form-letter-folder       = <No Value Set>
signature-file           = <No Value Set: using ".signature"> 
feature-list             =
            Set    Feature Name
            ---  ----------------------
  [ Composer Preferences ]
            [ ]  compose-cut-from-cursor
            [ ]  compose-maps-delete-key-to-ctrl-d
            [ ]  compose-rejects-unqualified-addrs

? Help      E Exit Setup   P Prev         - PrevPage A Add Value  % Print      
            C [Change Val] N Next       Spc NextPage D Delete Val W WhereIs    

The "user-domain" part is the part that appears after the "@" in your e-mail address. In my configuration it's configured to show my e-mail address as "joshuago at users dot sourceforge dot net". As far as I know, that will just make your e-mail address appear a certain way so that people can reply. It doesn't actually use that server to send or receive mail.

Make sure the username you are using on your Linux machine is the same as the username you have on the ISP or mail provider. If you don't have that, make sure you know how to use the adduser shell script (it's a text file with commands to give to Linux to add a new user). I only use "root" to take care of local system tasks, to dial in, and to start point-to-point protocol (PPP).

Using PINE with IMAP

For the longest time, I did not know how to use PINE with IMAP because I really never saw a need for it. Then Josh Myer, the co-author of this guide, just kind of blurted it out, and I tried it on his server. It worked.

The setup is really basic. In PINE setup (S, C after entering the program), fill in the inbox-path field with {mail.isp.net}inbox, where "mail.isp.net" is the hostname of the IMAP server.

The next time you enter PINE, your inbox will be the one stored on the server via IMAP.


Comments, questions, suggestions, corrections? Send them all to joshuago at users dot sourceforge dot net. You can also try using the help form or the guestbook, which is actually a feedback form.


Copyright © 1997-2000 Joshua Go (joshuago at users dot sourceforge dot net). All rights reserved. Permission to use, distribute, and copy this document is hereby granted. You may modify this document as long as credit to me is given.