Configuring Pine

This is one of those things that should be easy to find. However, every time that I reinstall Linux, I find that I have to look all over the place to remind myself how to do this.

However, this time I found a source that makes it as simple as it should be--the trouble is finding it as it's the ISP-Connectivity mini howto. The part about using fetchmail and Pine can be found here. I'm just adding a couple of gotchas for the newbie.

I would also like to add a note of warning--setting up fetchmail in this manner involves putting your password on your machine in plain text. NEVER do this as root. I honestly don't know if, in these security conscious days, fetchmail is still a viable alternative, but I will leave that decision to the reader. I tend to swing between overly paranoid and overly trusting, so, I'm not the best judge.

My friend Meph prefers using fetchmailconf, a nice GUI, to configure fetchmail. However, I've found that if you know how to do it, it's actually easier to use any text editor. His page, however, is the only other one that makes fetchmail and Pine as easy as they should be.

So, before starting Pine, let's configure

First, let's make sure it's installed. In RedHat, you'd type

rpm -q fetchmail

If you don't have it, it's definitely on your installation CD. Again, this is written for the newbie, so we're keeping it simple. So, you install it from your CD (in RH 7.1 and some earlier ones, you can access the CD through a GUI, click on it, and RH's package manager will install it for you.)

So, now that it's installed,there are a few ways to do this. I'm only giving you the simplest way, since, as you get more advanced, you will probably start getting into playing with your fetchmail configuration. (see man fetchmail for the infinite possibilities). However, this is for the single user who wants to try using Pine and hasn't done it before and would like to keep it very simple.

So, let's assume your isp is isp.com. Your user account is John, you want people to see that your mail comes from John Smith and your password is 1234. Your email account with your isp is john@isp.com. They've given you the information to configure Outlook Express. I'm assuming that it's a POP3 account. They've told you that your pop server is mail.isp.com and your smtp server is smtp.isp.com.

< a name="Now">Now, on your Linux box, you're going to create a user with the same name as your ISP account. This will enable you, with a minimum of extra configuration, to send mail from your normal email address. This can be important if, for example, you belong to a mailing list that only accepts mail from its members.

So,first let's log into your Linux box as root. As root, we're creating the user John

adduser john

Let's give john a password passwd john smith (you won't see the smith as you type it--you will, however, probably get a message that it's a bad Unix password as it's a dictionary word. In reality, passwords should be a mixture of alpahnumeric and upper and lower case, but, this is up to you.)

It will then ask you to retype the password, so you retype smith. Again, you won't see it, but by now you're probably familiar enough with Linux to not be surprised by that.

So, now that we have a user john, he also has a home directory. We can log off as root, the rest of our work will be done as john.

So, now we log in as john. We type the password smith and we're in john's home directory.

Ok, open up whatever text editor you prefer and type the following

poll mail.isp.com proto pop3 user john password 1234
user john with pass 1234 is john here

Save this file as .fetchmailrc (Note the period before fetchmailrc). Now, to avoid one of those annoying error messages, type the following

chmod 0710 .fetchmailrc

There, that wasn' hard, was it? Meph thinks that the GUI fetchmailconf is easier, but I can do it faster this way--plus,it's more fun to avoid the GUIs.

We could start fetchmail now, or configure Pine first. If you're on a dial up connection, there's no point in starting fetchmail at this point. If, however you're already on the Internet, you could start fetchmail, by typing

fetchmail &

The & sign after the command will run it in the background so you get your prompt right back.

As I'm on a cable connection, meaning that whenever my computer is on, I'm attached to the Internet, I run it as a daemon by typing

fetchmail -d 600

The -d flag means it should run as a daemon and the 600 indicates how often I want it to check for mail, in seconds. Therefore, I now have it checking my mail server every 10 minutes. (You can use any interval, however, some ISPs have a problem with people polling more often than every ten minutes

Now, let's open up and configure Pine. This is begun by typing

pine

(Note that it is usually case sensitive--typing Pine would return an error)

The first time you open it you get some sort of welcome message--at any rate, type E to exit that message and it brings you to another list. Type S for setup and then C for configuration. The top line, personal-name will be highlighted. To change the value, type C for change, and then you can enter in your information. Hitting return saves it.

So, we only have to configure three things here.

personal-name

John Smith

This is simply your display name.

userdomain

isp.com

The user domain is whatever is in your email address after the @sign.

smtp-server

smtp.isp.com

This is the address of your smtp server, information that you will have received from your ISP.

That's it, you're done. You can now send and receive email with Pine. If you're the only user on the box who is using fetchmail and Pine you could automatically start fetchmail by putting in the Pine user's .bashrc file

fetchmail -d 600

One other point. Pine depends upon an MDA (Mail Delivery Agent) to receive mail. Both Sendmail and Postfix will do the job on most Linux distros, however, they could be considered overkill for the single user. Procmail is also usually installed.

Therefore, one can add a line to their .fetchmailrc file, specifying Procmail as the mail delivery agent. After the two lines previously mentioned add:

mda "/usr/local/bin/procmail -d %T"

The quotation marks are necessary. The above is taken from a FreeBSD configuration. On your system, procmail may be located elsewhere. (Many Linux distributions have it in /usr/bin). Doing a
which procmail
at a command prompt should give you the proper path. I find that what usually happens when I do this is that I get an error message concerning smtp, then it collects the mail without problem. The errors will be something like

fetchmail: SMTP connect to localhost failed
fetchmail: SMTP transaction error while fetching from (your pop server's name)
fetchmail: Query status=10 (SMTP)
1 message for (username) at (pop server name)
reading message 1 of 1 (x octets)...flushed

I never did research the cause of this. The end result is that one gets their mail without problem.

This will, as mentioned above, run it as a daemon, checking mail every ten minutes. If you do this to more than one user however, it doesn't work correctly. Also, if you su during the session, when you go back to the Pine user account, you'll get an error message (that can safely be ignored, fetchmail is still running--the message has to do with the fact that it's trying to run again.)

If you have multiple users, the easiest way, it seems, to have fetchmail start automatically is to run it as a cron job. That is well explained on Meph's page so I won't bother going over it here.